Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
C file input/output
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{short description|Input/output functionality in the C programming language}} {{Use dmy dates|date=February 2022}} {{C Standard Library}} The [[C (programming language)|C programming language]] provides many [[standard library]] [[subroutine|functions]] for [[computer file|file]] [[input/output|input and output]]. These functions make up the bulk of the [[C standard library]] [[header file|header]] {{mono|<'''stdio.h'''>}}.<ref>{{cite book |title=ISO/IEC 9899:1999 specification |at=p. 274, Β§ 7.19 |language=en-US}}</ref> The functionality descends from a "portable I/O package" written by [[Mike Lesk]] at [[Bell Labs]] in the early 1970s,<ref>{{cite book |last1=Kernighan |first1=Brian |author-link1=Brian Kernighan |last2=Pike |first2=Rob |author-link2=Rob Pike |title=[[The UNIX Programming Environment]] |publisher=[[Prentice Hall]] |location=[[Englewood Cliffs]] |year=1984 |page=200|bibcode=1984upe..book.....K }}</ref> and officially became part of the [[Unix]] operating system in [[Version 7 Unix|Version 7]].<ref name="reader">{{cite tech report |first1=M. D. |last1=McIlroy |author-link1=Doug McIlroy |year=1987 |url=http://www.cs.dartmouth.edu/~doug/reader.pdf |title=A Research Unix reader: annotated excerpts from the Programmer's Manual, 1971β1986 |series=CSTR |number=139 |institution=Bell Labs}}</ref> The I/O functionality of C is fairly low-level by modern standards; C abstracts all file operations into operations on [[stream (computing)|stream]]s of [[byte]]s, which may be "input streams" or "output streams". Unlike some earlier programming languages, C has no direct support for [[random access|random-access]] data files; to read from a record in the middle of a file, the programmer must create a stream, [[fseek|seek]] to the middle of the file, and then read bytes in sequence from the stream. The stream model of file I/O was popularized by Unix, which was developed concurrently with the C programming language itself. The vast majority of modern operating systems have inherited streams from Unix, and many languages in the [[:Category:C programming language family|C programming language family]] have inherited C's file I/O interface with few if any changes (for example, [[PHP]]).
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)