When to flush a file in Go?

前端 未结 4 932
离开以前
离开以前 2021-02-07 06:35

When is it necessary to flush a file?
I never do it because I call File.Close and I think that it is flushed automatically, isn\'t it?

4条回答
  •  南笙
    南笙 (楼主)
    2021-02-07 07:26

    When you want to ensure data integrity as much as possible. For example, what happens if your program crashes before it comes to closing the file?

提交回复
热议问题