errno_t freopen_s ( FILE** pFile, const char *path, const char *mode, FILE *stream );
Here, the freopen_s disassociates the FILE pointer stream
from whatever it is pointing at, then associates it with the file that is located at path
. The mode
defines the limits for what could be done with this specific pointer stream
.
As far as I can tell, all these are nothing different than what would happen with:
...
fclose( stream );
fopen_s( &stream, path, mode );
...
My question is: What does the pFile
do there? freopen also has it, as the return value. From all the examples I have seen, pFile
, after the call, also points at the same file that is located at path
. So:
...
fclose( stream );
fopen_s( &stream, path, mode );
fopen_s( pFile, path, mode );
...
Is this really it?