Shared Flashcard Set

Details

Redirection
na
23
Computer Science
Undergraduate 2
01/18/2009

Additional Computer Science Flashcards

 


 

Cards

Term
What is Redirection?
Definition
a facility that lets you change the associations for the standard input and output
Term
What are Command-line arguments?
Definition
arguments that appear on the command line when you type a command
Term
ios_base::in
Definition
Open file for reading
Term
ios_base::out
Definition
Open file for writing
Term
ios_base::ate
Definition
Seek to end-of-file upon opening file
Term
ios::app
Definition
Append to end-of-file, may add data to end of file only
Term
ios_base::trunc
Definition
Truncate file if it exists
Term
ios_base::binary
Definition
Binary file
Term
ios_base::out
Definition
(Same as ios_base::out | ios_base::trunc)
Term
ios_base::out | ios_base::trunc
Definition
Open for writing, truncating file if it already exists
Term
ios_base::out | ios_base::app
Definition
Open for writing, append only
Term
ios_base::in | ios_base::out
Definition
Open for reading and writing, with writing permitted anywhere in the file
Term
ios_base::in | ios_base::out | ios_base::trunc
Definition
Open for reading and writing, first truncating file if it already exists
Term
c++mode | ios_base::binary
Definition
Open in C++ mode or corresponding cmode and in binary mode; for example, ios_base::in | ios_base::binary becomes "rb"
Term
c++mode | ios_base::ate
Definition
Open in indicated mode and go to end of file
Term
How do you save data in binary form instead of text form?
Definition
write()
Term
How do you recover information from a file?
Definition
read() with an ifstream object. Example:

ifstream fin("planets.dat", ios_base::in | ios_base::binary);
fin.read((char*) &pl, sizeof pl);

Term
What does Random access mean?
Definition
moving directly to any location in the file instead of moving through it sequentially
Term
What does seekg() do?
Definition
moves the input pointer to a given file location
Term
seekp() moves the output pointer to a given file location
Definition
Term
What does streampos represent?
Definition
absolute location in a file, measured from the beginning of the file
Term
How do you check the current position of a file pointer?
Definition
tellg() for input streams
tellp() for output streams
Term
What does clear() do?
Definition
resets the stream state, turning off eofbit
Supporting users have an ad free experience!