Question

I want to create a file that only resides in memory... In looking through some documentation I saw a recommendation to use a shell extension as a virtual file. Im not sure that is a workable solution but I would like to know

  1. Is it a good approach (or should I be using a ramdisk instead)
  2. Where is a good place to start to read up on it

Note: This is on the Windows platform

Was it helpful?

Solution

As I understand, you want your program to create a "file", which resides only in memory and that you can pass on to another external program (say, Microsoft Word).

AFAIK this is not possible, short of a ramdrive. I'd suggest using a temporary folder. You will however have to come up with a strategy for deleting the file when it's not needed anymore.

Added: On second though, you might want to check out Reparse points. I'm not familiar with them myself, and they will only work for NTFS formatted disks, but perhaps they can provide you with what you want. It will be a lot of coding though.

OTHER TIPS

You don't say on which plateform you are but I'm guessing Windows. Is mmap() available? If not, I think BerkeleyDB has been ported to Windows so you should be able to use that. Win32 API may have something akin to mmap() but I don't know it.

If you want a file that resides only in memory, use a named pipe or something, though I question your scenario - can you go up a level and describe what you want to do?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top