Difference between revisions of "Standard I/O library"

From Computer History Wiki
Jump to: navigation, search
(Covers the basics)
 
m (grammar typo)
 
(One intermediate revision by the same user not shown)
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 used.
  
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 operations in it:
 
 
Some things in it:
 
  
 
* getchar()
 
* getchar()
Line 15: 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.
  
 
==External links==
 
==External links==

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