Appendix B: Low Level I/O
C programmers on GNU/Linux have two sets of input/output functions at their disposal. The standard C library provides I/O functions:
fopen, and so on. The Linux kernel itself provides another set of I/O operations that operate at a lower level than the C library functions.
Because this book is for people who already know the C language, we'll assume that you have encountered and know how to use the C library I/O functions.
Often there are good reasons to use Linux's low-level I/O functions. Many of these are kernel system calls and provide the most direct access to underlying system capabilities that is available to application programs. In fact, the standard C library I/O routines are implemented on top of the Linux low-level I/O system calls. Using the latter is usually the most efficient way to perform input and output operations -- and is sometimes more convenient, too.
Throughout this book, we assume that you're familiar with the calls described in this appendix. You may already be familiar with them because they're nearly the same as those provided on other UNIX and UNIX-like operating systems (and on the Win32 platform as well). If you're not familiar with them, however, read on; you'll find the rest of the book much easier to understand if you familiarize yourself with this material first.