CSCI 103L Lecture Notes - Lecture 10: Null Character, Standard Streams

42 views4 pages

Document Summary

Input from keyboard comes in a memory stream called [stdin: input stream. Cout puts data in an output stream known as stdout" standard output: endl ushes the stream. New way to get data - from les: file i/o redirection and pipes. Make a . txt le of what you would type in the keyboard for cin. Redirection: use < at the command line with a le name and the computer will put it in like it was a cin, ex: . /hailstats < input. txt. Getline() and lines of text: cin stops reading at whitespace normally, if you want to read a whole line of text, use cin. getline() Reads a while line of text until it nds the new line character (i. e. the user presses enter: cin. getline(char *buffer, int max_chars) Ex: cin(mytext, 80: gets input puts it in mytext, max of 79 characters (leaves space for the null character.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions