Module 13 · Files
fprintf, fscanf and Formatted File Input and Output
Free with an accountReading
Amara keeps her class's marks in marks.txt, one student a line: a name and three marks. Lesson 2 can print that file. But Amara wants averages, and nobody can add up the text 92.
Checking what this lesson needs for you…
What is inside fprintf, fscanf and Formatted File Input and Output
- fprintf writes formatted text to a file
- fscanf reads fields back and returns a count
- sscanf reads the same fields from a string
- fgets then sscanf: a bad line costs one line
- A scanset reads a field up to a comma
- Records into an array of structs, and a table back out