UNIX File I/O

Many C programming texts teach the reader how to do I/O using the stdio(3) functions fopen(3), fgets(3), fread(3), fwrite(3), and the rest. Because UNIX supports the stdio(3) interface, many new UNIX programmers think of this as UNIX file I/O. However, this interface is simply the stdio(3) set of routines, which is layered on top of the UNIX system calls. The underlying system calls perform the real UNIX file I/O.

There will be times where you'll need to use the "bare metal calls" such as read(2) and write(2) under UNIX. These and other UNIX I/O functions will be covered in Chapter 4, "UNIX Input and Output." These ultimately give you the most control and, in some cases, relief from bugs in stdio(3).

Figure 2.1 illustrates ...

Get Advanced UNIX Programming 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.