Could fopen failure affect file system?

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?

+5
source share
3 answers

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.

+6
source

, fopen() , - - . , , open() O_WRITE. FILE *, fdopen().

0

, , - . fopen FILE, , , FILE. , fopen fdopen ( - ).

stdio , . , stdio- , , - , , .

0
source

All Articles