Standard I/O library

From Computer History Wiki
Revision as of 10:22, 1 January 2023 by Jnc (talk | contribs) (grammar typo)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Standard I/O library is now the canonical buffered input/output subroutine package for the C programming language (which does not include any I/O as part of the programming language itself). Its purpose is prinipally to allow applications to process one byte at a time efficiently. Although many operating systems allow a file to be read a byte at a time, the overhead of doing a whole system call for each byte will make the processing of the file a lot slower than using this library. Using this library also allows applications to be portable, by hiding the details of the operating system calls to be used.

Some operations in it:

  • getchar()
  • getc()
  • putchar()
  • putc()
  • feof()
  • ferror()
  • fileno()

look like subroutine calls, but are actually in-line macros.

It also includes a number of other capabilities, such as producing numeric output, structured output, etc.

It was a replacement for the earlier Portable C Library, which had basically the same functionality, but was structured slightly differently. In the Portable library, open files were identified by small integers; the standard library uses pointers to structures which hold all the data related to a particular file.

External links