Chapter 4. Files and File I/O
In this chapter
4.1 Introducing the Linux/Unix I/O Model page 84
4.2 Presenting a Basic Program Structure page 84
4.3 Determining What Went Wrong page 86
4.4 Doing Input and Output page 91
4.5 Random Access: Moving Around within a File page 102
4.6 Creating Files page 106
4.7 Forcing Data to Disk page 113
4.8 Setting File Length page 114
4.9 Summary page 115
Exercises page 115
This chapter describes basic file operations: opening and creating files, reading and writing them, moving around in them, and closing them. Along the way it presents the standard mechanisms for detecting and reporting errors. The chapter ends off by describing how to set a file’s length and force file data and metadata to disk.
Introducing the Linux/Unix ...
Get Linux® Programming by Example 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.