Bifalgorithm post · Computer science one · Closing Files
How do you write and read binary data in C?
How do you write and read binary data in C? (Computer science one · Closing Files) — "int x = 10;\n\nFILE *binaryOutputFile = fopen(\"demo.bin\", \"w\");\n\n//…
Ideas in this flowchart
- Binary file input and output in C
- Writing binary data
- Initialize the integer: int x = 10;
- Open demo.bin for writing
- Write one integer with fwrite
- Reading binary data
- Open input.bin for reading
- Read one integer with fread
- Allocate space for an array of 10 integers
- Read the entire array with fread