Difference between revisions of "Standard I/O library"

From Computer History Wiki
Jump to: navigation, search
(add detail on fundamentals)
m (grammar typo)
 
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). 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.
+
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 used.
  
Some things in it:
+
Some operations in it:
  
 
* getchar()
 
* getchar()
Line 13: Line 13:
 
look like [[subroutine]] calls, but are actually in-line [[macro]]s.
 
look like [[subroutine]] calls, but are actually in-line [[macro]]s.
  
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, 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 [[pointer]]s to [[structure]]s which hold all the data related to a particular file.
 
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.

Latest revision as of 10:22, 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 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