+ 3

What will happen if I don't call fclose() in C program?

Just to know for curiosity 😅. Will it be harmful to program or the file will not be accessed again?

3rd Aug 2021, 2:08 PM
Suyash
Suyash - avatar
4 Antworten
+ 8
Suyash , If an open file is not closed correctly, this can, in the worst case, lead to the total loss of the entire file content. however, this varies depending on the operating system. ▪︎when a file was not closed correctly before the program is terminated normally, the operating system will try to close the file. In many cases this can prevent a data loss. ▪︎when a file was not closed correctly, and the programm is terminated unexpectedly by a crash, the loss of data can hardly be prevented.
3rd Aug 2021, 3:01 PM
Lothar
Lothar - avatar
3rd Aug 2021, 2:32 PM
Amine Laaboudi
Amine Laaboudi - avatar
+ 3
If you neglect to close a shared file in a multi-user environment you will have great fun watching users throw up their hands, break office equipment, and express much anger at your software.
3rd Aug 2021, 3:13 PM
Brian
Brian - avatar
0
It is harmful to program due to a dynamic memory leak
3rd Aug 2021, 2:26 PM
Roma Butaku
Roma Butaku - avatar