1402 17 - COMP1002/1402 Chapter17:TextFiles...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
3/14/2010 1 COMP 1002/1402 Introduction to Systems Programming Chapter 17: Text Files Notes Adapted from Dr. J. Morrison, Dr D. Nussbaum File Types C has two main types: Binary Files Everything stored as 0’s and 1’s Text Files Usually human readable characters Each data line ends with newline char 2 COMP1002/1402 - Chapter 17: Text Files
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
3/14/2010 2 File Storage & Access Files are stored in auxiliary storage devices Read and Write access is buffered A buffer is a storage area It is temporary 3 COMP1002/1402 - Chapter 17: Text Files Streams File Input and Output is done : Element by element Essentially a stream of information All File structures are byte streams in C. 4 COMP1002/1402 - Chapter 17: Text Files
Background image of page 2
3/14/2010 3 A FILE FILE is the type we use to reference “files” Defined in stdio.h Usually declare variable as a pointer : FILE *filename; 5 COMP1002/1402 - Chapter 17: Text Files File Table The details are unnecessary But here they are The details are unnecessary.But here they are…. FILE is linked to File Tables File Table : name of file , location of buffer , current state of the file 6 COMP1002/1402 - Chapter 17: Text Files
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
3/14/2010 4 Standard Files Stdio.h defines 3 standard streams (files) Standard Input ( stdin ) Standard Output ( stdout ) Standard Error ( stderr ) 7 COMP1002/1402 - Chapter 17: Text Files The Standard Files 8 COMP1002/1402 - Chapter 17: Text Files
Background image of page 4
3/14/2010 5 User Files Standard Files are opened automatically User files must be opened by the user Can be opened for input or output
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 17

1402 17 - COMP1002/1402 Chapter17:TextFiles...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online