This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Descriptions of a few functions for file manipulation. This is not exhaustive. There are other methods for reading and writing from and two a file. fgets In order to read from a file or write to a file, you must have a file pointer pointing to the file that you wish to read from or write too. Such pointers are of the FILE* datatype. Then you would use the fopen function to open a relevant file. The declaration would look like the line below. FILE* InputFile = fopen("name_of_file.ext", "w") The function fopen(char*, char*) has two arguments, one of them is a string with the name of your file, and the other one is a string delimiting the way you wish to open your file. "r" means read, "w" means overwrite, "a" means append to the end. "t" means open the file as a text file (This is the default if you put nothing but a "r" or a "w" it will open as a text file). "b" means open the file as a binary file....
View Full Document
This note was uploaded on 11/14/2011 for the course CSCI 1132 taught by Professor Haya during the Fall '11 term at GWU.
- Fall '11
- C Programming