On Wed, 10 Mar 2004 22:40:44 +1100
Lucas King <[EMAIL PROTECTED]> wrote:

> hello,
> 
> a somewhat technical question - i am trying to associate a file 
> descriptor with a file pointer using the C++ fstream class.  this 
> function is an extension to the C++ library.
> 
> in the documentation that i downloaded from the WEB 
> (http://nf.apac.edu.au/facilities/sc/compaq_mirror3/progtool/cplus/basic_fstream_3c__std.htm)


That doco is for the RogueWave library, which is not necessarily in the standard.
In fact I'm pretty sure it's not, because file descriptors are a unix
thing not a language (c++) thing

> it shows a constructor, explicit basic_fstream(fd).  i take this to mean 
> that it can be done.  however, it does not provide an example on how to 

I've been wanting to do a similar thing, and the thing to use
is a gnu extension.  Beginning with g++ 3.1, you should use 
a class __gnu_cxx::stdio_filebuf which is defined in the include file 
<ext/stdio_filebuf.h> (aka /usr/include/g++/ext/stdio_filebuf.h)

But I'm right in the middle of doing this and haven't got anything working
at the moment.  The net is a bit short on examples!


Matt
PS. I want this so I can popen nicely from within c++.
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to