im trying to open an existing file in "rb" mode and i need to decrypt returning a new FILE* without overwrite the original file or creating new temporary one. in short words, i need something like this:
FILE *decrypt(){
FILE *cryptedfile = fopen("file.ext", "rb");
//... my decrypter code
return (the decrypted file as FILE*).
}
so, there is a way to do something like "cast char* to FILE*"?
i have tried many different solutions without success, i have also tried to create a new tmpfile() but the result seems do not work properly and i do not want to create a tmpfile anyway, but just keep it into the memory.
thanks :)