Is the fclose() function optional or should be writen when creating single file. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is the fclose() function optional or should be writen when creating single file.

Understanding the using of fopen and fclose

14th Oct 2016, 6:53 PM
Cliff James
Cliff James - avatar
3 Answers
+ 3
Always close the files you open. As long as a file is opened, it can't be used by other programs.
14th Oct 2016, 7:09 PM
Zen
Zen - avatar
0
Additional, an open file pointer to a file will stay in memory, hence earing up your RAM on large scaled projects.
16th Nov 2016, 9:44 PM
Oliver Jakobi
Oliver Jakobi - avatar
0
a file opened and not being used wastes memory, close all files when not in use!!
26th Nov 2016, 7:59 AM
iJean
iJean - avatar