Skip to content

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

20241201011427 20241201012000

10.2 Files

20241201153514 20241201153541 20241201154534

10.3 Opening and Closing Files

20241202003149 20241202003247

10.4 Reading and Writing Files

20241202012420

10.10 Standard I/O

20241203210024

10.11 Putting It Together: Which I/O Functions Should I Use

20241203222914 20241203222934

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.