So, I have temporary data in my program (in RAM). I want to somehow show that this is a file (for example, to send it to another program that takes a file link as an argument)?
Is it possible?
How to do it?
You can do this in C using the popen() function:
popen()
FILE *f = popen("program args", "w"); // write your output to f here using stdio pclose(f);
This is possible if your external program reads its input from stdin .
stdin
Why not just burn the file to disk? If writing to disk is too slow, you can pass the FILE_ATTRIBUTE_TEMPORARY flag to CreateFile to save the data in the cache (and not write it to the physical device).
FILE_ATTRIBUTE_TEMPORARY
Sometimes obvious solutions are the best ...
If you support your operating system (Unixoid and Windows systems), you can try to use memory mapped files .
You can use pipe ()
The pipe () function shall create a pipe and place two file descriptors, one each into the arguments fildes [0] and fildes [1], that refer to the open file descriptions for the read and write ends of the pipe. Their integer values shall be the two lowest available at the time of the pipe () call. The O_NONBLOCK and FD_CLOEXEC flags shall be clear on both file descriptors. (The fcntl () function can be used to set both these flags.)
Yes it is possible. You can transfer your data to another application through the interprocess communication mechanism:
EDIT: MSDN lists all the IPC mechanisms available for Windows here .