I need to create a FILE struct from data stored into an array. In my code I have the fopen function, which returns a FILE. The idea is to read all data stored in array, convert to FILE struct and finally return the FILE.
I.e:
FILE validFile (char *fileName){ char *data; FILE *fp; data = malloc(sizeof(char*)); populateData(data); fp = fopen(data, "r"); return fp; }
Is that possible?
Similar function exists in GLIB C library; fmemopen.
Thanks and best regards,
Cristian.