4. Terminal I/O

4.1 Introduction

Terminal I/O is so complex that it needs most of a chapter all to itself. The problem isn’t with normal terminal I/O, which I’ll start with—that’s even simpler than file I/O. What complicates matters are the numerous variations in terminal attributes. In this chapter I’ll also explain how terminals are related to sessions and process groups. Then I’ll show how to set up pseudo terminals, which allow one process to control another process that’s written for a terminal.

Terminal I/O on UNIX treats a terminal like an old-fashioned hard copy Teletype, the model with the massive type box that makes a terrible racket as it bounces around, now seen only in museums or old movies. There is no specific support in the ...

Get Advanced UNIX Programming, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.