Closed pfusik closed 3 months ago
cppreference says:
If filename is a null pointer, then the function attempts to reopen the file that is already associated with stream (it is implementation defined which mode changes are allowed in this case). Microsoft CRT version of freopen does not support any mode changes when filename is a null pointer and treats this as an error
If that's good enough for Microsoft CRT, I suggest to make it simple and only store the filename for DELONCLOSE
/tmpfile
.
At least on the Atari, you can delete a file by its name, but not a handle.
filename = stream->filename;
leaks.free(stream->filename);
double free.strcpy(stream->filename, filename);
null-dereference on OOM (also infopen
).