I need to transfer some data - char buffer[100000];
- to a child process which is started by me.
Right now I'm using an ordinary file to do so, the parent process writes the data to a file on disk, and the child process reads it from disk and deletes the file. However, that causes unnecessary writes to the disk, so I want to use memory-mapped files instead.
How do I create, write to, and then read from a memory-mapped file in such a way that no data is written to disk, except when the pagefile or swap file is used?
Edit: I forgot to specify that I want to use raw WINAPI functions, so the code doesn't have dependencies. I am researching on how to do it and will post an answer myself when ready, but if someone has ready-made code, they're welcome to save me some effort :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…