Hi, I was playing around with memory-mapped files in C and was wondering if there is a way to replace the FILE * from fopen with a memory mapped file transparently.
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 would open a file on disk mmap it, maybe change contents and then pass back the FILE * without the program seeing anything different except the new my_fopen() and my_fclose().
Is this possible to do without having to rewrite the way the operations are done in the program?