"DigitalDragon" <kreso@cateia.com> writes:[color=blue]
> er, i used a bad example. the point i'm trying to make is if i have already
> loaded a file into memory, and now i want to pass the FILE pointer to
> another library to read that file, but i dont want to reread if from disk,
> but rather from memory. is that even posibile?[/color]
So the data you have in memory is the content of the file, not its name.
No, there's no way to do that in standard C (other than by writing the
data to an external file and reading it back in). Some
implementations may provide this as an extension (<OT>fmemopen</OT>),
but of course any code that uses such an extension is non-portable.
A slightly more portable approach might be to copy the data to an
external file on a filesystem that's implemented in memory (if your
system provides such a thing). It's "slightly more portable" in the
sense that, if the system doesn't provide an in-memory filesystem, you
can change the file name and accept the poorer performance.
I see you cross-posted this to comp.lang.c and comp.lang.c++. I'm
posting from comp.lang.c. It's possible that C++ provides a standard
way to do what you want. If anyone wants to discuss it, please post
only to comp.lang.c++; here in comp.lang.c we're a bit sensitive about
topicality.
--
Keith Thompson (The_Other_Keith)
kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"