I played with memory mapped files in C and wondered if there is a way to replace FILE * from fopen with a transparent memory file.
Example:
FILE * fp = g_fopen(...);
//Program does things to this fp.
fclose();
But instead, is it possible to have FILE * fp = my_fopen (...)
Where my own function will open the file on the mmap disk, it may change the contents and then pass FILE * without the program, seeing anything other than the new my_fopen () and my_fclose ().
Is it possible to do this without having to rewrite the method of performing operations in the program?
James source
share