Chapter 10 System-Level I/O
Input/output(I/O) is the process of copyign data between main memory and external devices such as disk drives, terminals, and networks. An input operation copies data from an I/O device to main memory, and an output operation copies data from memory to a device.
10.1 Unix I/O
10.2 Files
10.3 Opening and Closing Files
10.4 Reading and Writing Files
10.10 Standard I/O
10.11 Putting It Together: Which I/O Functions Should I Use
we recommend that you not use the standard I/O functions for input and output on network sockets. Use the robust Rio functions instead. If you need formatted output, use the sprintf
function to format a string in memory, and then send it to the socket using rio_writen
. If you need formatted input, use rio_readlineb
to read an entire text line, and then use sscanf
to extract different fields from the text line.