Module 13 · Files
Binary Files, fread and fwrite
Free with an accountReading
Kenji's racing game saves his best lap: 83.456789 seconds. He wants a small save file, so he writes the time with %.2f, the way lesson 3 wrote numbers. The next day the game loads 83.46. His record got slower overnight, without a single lap.
Sign in to read
This lesson is free, with an account
An account costs nothing and opens every lesson in this track that is not marked Pro, on every device you read on.
What is inside Binary Files, fread and fwrite
- Text rounds the number, bytes keep it
- fwrite and fread copy bytes
- The counts they return
- fseek and ftell: the file position
- A record by its index
- A binary file is not portable
- Text or binary: how to choose