Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

So I have some temp data in my program (in RAM). I want to somehow make it seem as it is a file (for example for sending it into another program which takes a file link as argument)?

Is it possible?

How to do such thing?

like image 535
Rella Avatar asked May 30 '10 22:05

Rella


2 Answers

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...

like image 181
Dean Harding Avatar answered Sep 20 '22 10:09

Dean Harding


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

like image 21
Daniel Brückner Avatar answered Sep 21 '22 10:09

Daniel Brückner