在根目录下的实际上就是Ram文件系统。
还有一个帖子是这样说的,如果你的文件IO是标准的C的话,内存的访问和文件的访问时不可移植的,但是如果是C++,就可以搞定。
因为在C++中可以把对内存的操作和文件的操作再进行一次封装。
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 (fmemopen),
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.
这里这个in-memory filesystem,我的理解就是Ram filesystem
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.