FileReadingAndWriting_1

FileReadingAndWriting_1 - Descriptions of a few functions...

Info iconThis preview shows pages 1–2. 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 DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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.

Page1 / 2

FileReadingAndWriting_1 - Descriptions of a few functions...

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