This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ifstream(int/FILE*) filebuf(FILE*)


On Tue, Aug 28, 2001 at 11:27:34AM +0200, Jean Müller wrote:
>   I tried to compile old C++ code with new libstdc++-v3 and i can't find
> a constructor of class istream or ifstream (same for output) that can
> re-use a Unix file descriptor int or FILE (open, popen, fdopen, etc...).

There is none.  C++ does not assume that "file descriptors" exist.

> I've found the constructor of class filebuf that use a FILE* argument but
> i can't find the way to have a istream/ifstream using this filebuf...

Have you tried fdopen()?

This constructor is primarily for internal use.  It changes as we need it
to change.  It's completely non-standard, so don't depend on it.


>   Second question : why c_file_type is FILE* and not int ?

Why should it be int?  Not every platform uses integers to represent files.


Phil

-- 
Would I had phrases that are not known, utterances that are strange, in
new language that has not been used, free from repetition, not an utterance
which has grown stale, which men of old have spoken.
                                     - anonymous Egyptian scribe, c.1700 BC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]