Set: C++: Input/Output with files

Familiarize

Learn

Test

Play Scatter

Play Space Race

Combine with other sets Login to add to Favorites
Print: Term List | Flashcards Editing not allowed
Export Deleting not allowed

Share these flash cards

With group: None
HTML link to set: Tiny link:
Share on Facebook Share on MySpace

All 22 terms

TermDefinition
ofstreamstream class to write on files
ifstreamstream class to read from files
fstreamstream class to both read and write from/to files
file.open (filename, mode);in order to open a file with a stream object
file.close()to close a file
eof ()member function that returns true in the case that the end of the file has been reached
bad ()Returns true if a reading or writing operation fails. For example in the case that we try to write to a file that is not open for writing or if the device where we try to write has no space left.
fail ()Returns true in the same cases as bad(), but also in the case that a format error happens, like when an alphabetical character is extracted when we are trying to read an integer number.
good ()It is the most generic state flag: it returns false in the same cases in which calling any of the previous functions would return true.
get pointerpoints to the element to be read in the next input operation
put pointerpoints to the location where the next element has to be written
tellg()have no parameters, return a value of the member type pos_type, which is an integer data type representing the current position of the get stream pointer
tellp()have no parameters, return a value of the member type pos_type, which is an integer data type representing the current position of the put stream pointer
seekg( position ); allow us to change the position of the get to the absolute position "position"
seekp( position ); allow us to change the position of the put to the absolute position "position"
seekg( offset, direction ); allow us to change the position of the get to an offset value relative to some specific point
seekp( offset, direction); allow us to change the position of the put to an offset value relative to some specific point
write ( memory_block, size );inputs binary data sequentially; is a member function of ostream inherited by ofstream
read ( memory_block, size );outputs binary data sequentially; is a member function of istream and is inherited by ifstream
ifstream::pos_type is a specific type used for buffer and file positioning and is the type returned by file.tellg()
 memory_block is of type "pointer to char" (char*), and represents the address of an array of bytes where the read data elements are stored or from where the data elements to be written are taken
size parameter is an integer value that specifies the number of characters to be read or written from/to the memory block.

Set Information

Terms 22
Creator jtwilliams00
Created March 30, 2009
Groups None
Subjects C++, C plus plus, programming
Access Anyone
Edit Creator Only
Get rid of ads on Quizlet
Pop out

Discuss

No Messages
Last Message: never

You must be logged in to discuss this set.