How to treat RAM data as if it was a real file? How to treat RAM data as if it was a real file? windows windows

How to treat RAM data as if it was a real file?


Why not simply write the file to disk? If writing to disk is too slow, you can pass the FILE_ATTRIBUTE_TEMPORARY flag to CreateFile to keep the data in cache (and avoid writing it to the physical device).

Sometimes the obvious solutions are the best...


If supported by your operating system (Unixoid systems and Windows do), you could try to use memory-mapped files.


You can do it in C using the popen() function:

FILE *f = popen("program args", "w");// write your output to f here using stdiopclose(f);

This is possible if your external program reads its input from stdin.