Getting a file descriptor or a file number) for an fstream (Was: Accessing the underlying file descriptor in fstream)
Gabriel Dos Reis
gdr@codesourcery.com
Wed Feb 14 21:31:00 GMT 2001
Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr> writes:
| [1 <text/plain; us-ascii (7bit)>]
|
| gdr@codesourcery.com said:
| > If your need is to have a C++ ISOstream operating over a FILE* C or a
| > int, then it should be not be hard to implement your own class
| > (derived from standard stream classes) to implement your policy.
| > Passing them back to the rest of the standard algorithms should be
| > trouble-less.
|
| No my problem is the opposite. I have a stream and at some point I
| want to memory map part of the file that has been open throught the
| stream and I do not have the file name any longer.
Well let's make this straight. The thing on top of which IOStreams are
implemented aren't directly accessible to you. In case a number is
returned you won't know what to do with it because the lowest-level
abstraction doesn't have universal, well-defined, useful semantics;
it's just OS-specific. Even if you ever get that number, you don't
know higher-level abstractions will interact will that lower-level
abstraction.
-- Gaby
CodeSourcery, LLC http://www.codesourcery.com
More information about the Libstdc++
mailing list