Simple Stream I/O in C++

data.dat Data file used in these examples.
echoChar.cpp Simplest example: copy a file to the screen one character at a time.
echoInt.cpp Copy a file's characters' ASCII codes to the screen.
echoLines.cpp Copy a file to the screen one line at a time.

readInt.cpp Semi-robust integer input.
readWord.cpp What >> does with strings.

comline.cpp Echo the command line to the screen and to a user-specified file.
noStreamCopy.cpp Streams cannot be copied...
altStreamCopy.cpp ... but the address of a stream can be copied.
echoInt2.cpp Echo an input file's ASCII contents to the screen or to a file, if requested.
echoInt3.cpp Illustrates more tricks with pointers.
echoInt4.cpp Avoids pointers altogether.

myGetline/ Build your own getline function. Especially useful for MS VC++ users.
istreamGetline/ C-style istream::getline() function.
longLiterals.cpp How to break a string literal across multiple lines of a source file.
stringData.cpp Don't use the string::data() function! Instead, use string::c_str().