4 ms·
I see a lot of saves work like this: f = open( "the_file.new.$$" ); write( f, new_contents ); close( f ); rename( "the_file.new.$$", "the_file.
by 6c696e7578 8y ago
I see a lot of saves work like this:
f = open( "the_file.new.$$" );
write( f, new_contents );
close( f );
rename( "the_file.new.$$", "the_file.new" )
If not implemented like this, then something that attempts to read "the_file.new" may get partial contents, normally truncated along the file system block size.
Backups often take place, too, like you mentioned, depending on editor.