C++ IOStreams Quick Reference
Standard I/O - requires iostream.h header file

cin				Standard input stream 
cin.get()			Input and returns a single character
cin.get(chr)			Input a single character into chr
cin.getline(str, ln, chr)	Input a string of length ln or until chr
cin.ignore(n)			skips over n chars (default is 1)		
cin.putback(char)		returns char ch to input stream
cin.peek()			returns next char in input stream w/o removal 

cout				Standard output stream
cout.put()			argument is single char or ASCII decimal equiv. 
Stream Input Error States

cin.rdstate()			returns error state of stream
cin.eof()			returns true if EOF
cin.fail()			set by input of wrong datatype
cin.bad()			set by loss of data
cin.good()			!eof && !fail && !bad
cin.clear()			reset ios::goodbit
cin.clear(ios::failbit)		reset specified error state
String Stream I/O - requires strstream.h header file
istrstream instr(char *)	instantiate an istrstream object
ostrstream outstr		instantiate an ostrstream object
outstr.str() 			return a pointer to the output string
Sequential File I/O - an ASCII character file divided into 1 byte chunks 
                       requires fstream.h header file

file.open(char*,ios::mode)	Open an fstream with given mode
file.close()			Close an ofstream
operator void*			pointer set to NULL if failbit or badbit set  
!file				TRUE if input/output file not opened or EOF 
seekg(n)		 	reposition ifstream object file ptr to byte n 	
tellg()				return current ifstream object file pointer
seekp(n)			reposition ofstream object file ptr to byte n 
tellp()				return current ofstream object file ptr
ios::beg			default relative location for reposition
ios::cur			reposition relative to current position
ios::end			reposition relative to end of stream
File Open Modes
ios::app			write all output to end of file
ios::ate			open output file and move to the end of file
ios::in				open a file for input
ios::out			open a file for ouput in trunc mode (default)
ios::trunc			open for output and discard the file's content
ios::binary			open a file for binary (non-text) i/o
I/O Manipulators - requires iomanip.h header file

setfill(ch)			Set the fill character to ch
fill(ch)			Set the fill characte and return prior one
setw(n)				Set the field width to n
setprecision(n)			Set the floating-point precision to n places
setiosflags(flags)		Set the format flags
dec				Set output for decimal display
hex				Set output for hexadecimal display
oct				Set output for octal display
endl				Insert newline and flush stream
flush				Flush an ostream

Format Flags for setiosflags( )

ios::showpoint	Always show the decimal point (default of 6 decimal digits)
ios::showpos	Display a leading + sign when the number is positive
ios::fixed	Display up to 3 integer digits and 2 digits after the decimal 
                point. For larger integer values revert to exponential notation
ios::scientific	Use exponential display on output
ios::showbase	Show base indicator on output
ios::dec	Display in decimal format
ios::oct	Display in octal format
ios::hex	Display in hexadecimal format
ios::left	Left justify output
ios::right	Right justify output
ios::stdio	Flush stdout and stderr after insertion
ios::skipws	Skip whitespace on input

Note: These flags may be combined by OR operators. For example, 
setiosflags(ios::showpoint | ios::left) sets the showpoint and left
flags together.

cout << setiosflags( ios::fixed | ios::showpoint ) << setprecision( 2 )