O'Reilly logo

C Programming Absolute Beginner’s Guide, Third Edition by Dean Miller, Greg Perry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

29. Saving Random Files to Your Computer

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, when you open a sequential file for reading, you can only read it.

Sometimes you might 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 information into a variable, change it, and then write it back to disk exactly where it first resided. As Figure 29.1 shows, random files ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required