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).
FILE_ATTRIBUTE_TEMPORARY
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:
popen()
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.
stdin