Chapter
Closing Files
From ComputerScienceOne by Dr Chris Bourke
Concepts
- How do you write and read binary data in C?
"int x = 10;\n\nFILE *binaryOutputFile = fopen(\"demo.bin\", \"w\");\n\n//write a single int to a file:\n\nfwrite(&x, sizeof(int), 1, binaryOutputFile);\n\nFILE *binaryInputFile = fopen(\"input.bin\",
- How should you close files in C?
"Once you are done processing a file, you should close it using the fclose() function:\n\nint fclose(FILE *fp);\n\nwhich takes a single argument, the FILE pointer of the file you wish to close. Closin