29. Is There Another Way to Save Files?

Use Random Files

image

This chapter shows you how to skip around in a file, reading and writing data as you go. The preceding chapter introduced methods you can use to write, read, or append data to a file. The problem is that once you open a sequential file for reading, you can only read it.

There might be times when you want to read a customer structure from disk and change the customer’s balance. You certainly wouldn’t want to have to create a new file just so you could write that one change. Instead, you would want to read the customer ...

Get Absolute Beginner’s Guide to C, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.