Chapter

Closing Files

From ComputerScienceOne by Dr Chris Bourke

Concepts

  1. 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\",

  2. 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

Closing Files | ComputerScienceOne | Bifalgorithm | Bifalgorithm