C++ FAQ Celebrating Twenty-One Years of the C++ FAQ!!!
(Click here for a personal note from Marshall Cline.)
Contents - 40 sections.
12345678910111213141516171819202122232425262728293031323334353637383940 ]
About the Author.
Marshall Cline
cline@parashift.com
Topical index - 5676 links to 3571 topics.
ABCDEFGHIJKLMNOPQRSTUVWXYZ ]
Search the C++ FAQ.
Recent changes - 11 changed FAQs.
In a list, or in a chain, or here: [4.1], [4.2], [6.3], [6.12], [10.3], [15.22], [27.15], [35.13], [35.14], [35.15], [39.6].
Mirrored in 11 countries.
USA, France, Germany, Ireland, Israel, Italy, Poland, Portugal, Spain, Taiwan, U.K..
[15] Input/output via <iostream> and <cstdio>
15.1 Why should I use <iostream> instead of the traditional <cstdio>?
15.2 Why does my program go into an infinite loop when someone enters an invalid input character?
15.3 How can I get std::cin to skip invalid input characters?
15.4 How does that funky while (std::cin >> foo) syntax work?
15.5 Why does my input seem to process past the end of file?
15.6 Why is my program ignoring my input request after the first iteration?
15.7 Should I end my output lines with std::endl or '\n'?
15.8 How can I provide printing for my class Fred?
15.9 But shouldn't I always use a printOn() method rather than a friend function?
15.10 How can I provide input for my class Fred?
15.11 How can I provide printing for an entire hierarchy of classes?
15.12 How can I open a stream in binary mode?
15.13 How can I "reopen" std::cin and std::cout in binary mode?
15.14 How can I write/read objects of my class to/from a data file?
15.15 How can I send objects of my class to another computer (e.g., via a socket, TCP/IP, FTP, email, a wireless link, etc.)?
15.16 Why can't I open a file in a different directory such as "..\test.dat"?
15.17 How can I tell {if a key, which key} was pressed before the user presses the ENTER key?
15.18 How can I make it so keys pressed by users are not echoed on the screen?
15.19 How can I move the cursor around on the screen?
15.20 How can I clear the screen? Is there something like clrscr()?
15.21 How can I change the colors on the screen?
15.22 How can I print a char as a number? How can I print a char* so the output shows the pointer's numeric value? Updated!