Is it necessary to close files after reading (only) in any programming language?

后端 未结 3 1772
遇见更好的自我
遇见更好的自我 2020-12-11 10:12

I read that a program should close files after writing to them in case there is still data in the write buffer not yet physically written to it. I also read that some langua

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-11 11:07

    Yes, it's better to close file after reading is completed.

    That's necessary because the other software might request exclusive access to that file. If file is still opened then such request will fail.

提交回复
热议问题