Difference between revisions of "Standard I/O library"

From Computer History Wiki
Jump to: navigation, search
(Covers the basics)
 
(add detail on fundamentals)
Line 1: Line 1:
The '''Standard I/O library''' is now the canonical [[buffer]]ed [[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.
+
The '''Standard I/O library''' is now the canonical [[buffer]]ed [[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 [[application]]s to process one [[byte]] at a time efficiently. Although many [[operating system]]s 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.
 
 
Its purpose is prinipally to allow [[application]]s to process one [[byte]] at a time efficiently. Although many [[operating system]]s 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:
 
Some things in it:
Line 16: Line 14:
  
 
It also includes a number of other capabilities, such as producing numeric output, and structured output.
 
It also includes a number of other capabilities, such as producing numeric output, and structured output.
 +
 +
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 [[pointer]]s to [[structure]]s which hold all the data related to a particular file.
  
 
==External links==
 
==External links==

Revision as of 00:05, 1 January 2023

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

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