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 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.