...

/

I/O Streams

I/O Streams

Delve into the input/output methods provided by the C standard library and learn how to interact with the command-line terminal.

Streams in C

The standard C library (linked to using #include <stdio.h>) includes a handful of functions for performing input and output in C.

C and UNIX make use of a concept called streams in which data can be sent and received between programs, devices, and the operating system. We can distinguish between two types of streams: text and binary.

  • Text streams are made up of lines, where each line has zero or more characters, and is terminated by a new-line character \n.
  • Binary streams are more “raw” and consist of a stream of any number of bytes.

C programs all have three streams “built-in”: standard input, standard output ...