How can I do an atomic write/append in C#, or how do I get files opened with the FILE_APPEND_DATA flag?

后端 未结 3 1832
鱼传尺愫
鱼传尺愫 2020-12-28 17:13

Under most Unixes and Posix conforming operating systems performing an open() operating system call with the O_APPEND indicates to the OS that writes are to be atomic append

3条回答
  •  难免孤独
    2020-12-28 17:26

    Why can't you use

    System.IO.File.AppendAllText("C:\\somefile.txt", "some content");
    

    ? That's a thread-safe/"atomic" call as well.

提交回复
热议问题