C file input/output: Difference between revisions

Content deleted Content added
m dab file
mNo edit summary
Line 24:
a+b or ab+ Append: open or create binary file for update, writing at end-of-file
 
The C standard gives two kinds of files: text files and binary files, although operating systems may or may not distinguish between the two. A ''text file'' is a file consisting of text arranged in lines with some sort of distinguishing end-of-line character or sequence (in [[Unix]], a bare linefeed character; in the [[Apple Macintosh|Macintosh]] OS, a bare carriage return; on [[MS-DOS]] and [[Microsoft Windows]], a carriage return followed by a linefeed). When bytes are read in from a text file, an end-of-line sequence is usually mapped to a linefeed for ease in processing. When a text file is written to, a bare linefeed is mapped to the OS-specific end-of-line character sequence before writing. A ''binary file'' is a file where bytes are read in "raw", and delivered "raw", without any kind of mapping.
 
A conventient way to find the length of a file in C is: