Module 13 ¡ Files
Reading and Writing Text Files
Free with an accountReading
Every evening Maria's till program writes one line: the day, and how many sales it made. She wants a log, a list that grows by one line a day.
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 Reading and Writing Text Files
- Write lines, then read them back
- fgets keeps the newline
- Append mode: the log grows at the end
- The file position, and rewind
- One function for a file and for stdin