FileReview - C Programming Language Basic Text File access...

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

View Full Document Right Arrow Icon
C Programming Language Basic Text File access review notes. Prepared by Dr. Leeson A file is a data target or data source that resides on disk and is completely independent from your C program. A file on disk exists whether or not your program is active in memory. It has a name of its own and a location of its own. In order to connect your C program to a file, you need to 1) declare a file pointer variable in your program 2) connect that file variable to the actual disk file with an fopen function call 3) remember to break the connection when you are finished with the file by an fclose function call. In between steps 2 and 3, all communication between your program and the disk file is accomplished by referencing the file pointer variable and not by using the file’s disk name. The only place the file’s disk name is used is in the fopen function call. The fopen function determines the mode of communication that your program will use in communicating with the file. The file can be opened for reading ( using “r” mode) or opened for writing ( using “w” mode). Let us assume that a text file
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

FileReview - C Programming Language Basic Text File access...

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

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