Ch11 - CSEB114 PRI NCI PLE OF PROGRAMMI NG Chapt er 11 Data...

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: CSEB114: PRI NCI PLE OF PROGRAMMI NG Chapt er 11: Data Files & File Processing Objectives I n this chapter, you will learn about Files and streams Creating a sequential access file Reading data from a sequential access file Using fgetc() and fputc() Using fgets() and fputs() Using fprintf() and fscanf() Using fopen() and fclose() prepared by NI , edited by MAF Files and Streams C views a file as a sequential stream of bytes. A file ends either with an EOF (end-of-file) marker or at a specified byte number specified by the system. When a file is opened, a stream is associated with a file. Streams provide communication channels between files and the programs. prepared by NI , edited by MAF 0 1 2 3 4 5 6 7 8 . . . . . n-1 Files and Streams I n addition to providing access to a file, a stream can also be used to access devices. For example, when a program (any program) is executed, 3 streams are automatically opened: standard input (stdin) enable the program to read data from keyboard standard output (stdout) enable the program to print data on the screen standard error (stderr) enable program to print errors on the screen They are all manipulated using file pointers. prepared by NI , edited by MAF Declaring a file The standard library <stdio.h> provides some of the file manipulation function....
View Full Document

{[ snackBarMessage ]}

Page1 / 16

Ch11 - CSEB114 PRI NCI PLE OF PROGRAMMI NG Chapt er 11 Data...

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