Difference between revisions of "Standard I/O library"

From Computer History Wiki
Jump to: navigation, search
(Covers the basics)
(No difference)

Revision as of 23:53, 31 December 2022

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). It was a replacement for the earlier Portable C Library, which had basically the same functionality, but was structured slightly differently.

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

Some things 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, and structured output.

External links