If fopen (path, "w") completed successfully, then the file will be truncated. If fopen does not work, is there any guarantee that the file is not modified?
There are no guarantees regarding the state of the file if it fopen(path, "w")does not work. A failure can occur from any operation when opening a file, trimming to disk, etc. The only guarantee of failure is that you do not have access to the file.
fopen(path, "w")
, fopen() , - - . , , open() O_WRITE. FILE *, fdopen().
, , - . fopen FILE, , , FILE. , fopen fdopen ( - ).
fopen
FILE
fdopen
stdio , . , stdio- , , - , , .
stdio