CSCI 1300 Chapter Notes - Chapter 7: Newline, Carriage Return, Decimal Mark
40 views4 pages
9 Nov 2018
School
Department
Course
Professor
Document Summary
Here is precisely what happens when that operation is executed. First, any input characters that are white space are removed from the stream, but they are not added to the word. White space includes spaces, tab characters, and the newline characters that separate lines. The first character that is not white space becomes the first character in the string word . More characters are added until either another white space character occurs, or the end of the file has been reached. The white space after the word is not removed from the stream. Instead of reading an entire word, you can read one character at a time by calling the get function: char ch; in_file. get(ch); This is useful if you need to process characters such as spaces, tabs, or newlines. On the other hand, if you are not interested in white space, use the >> operator instead. in_file >> ch; // ch is set to the next non-white space character.
Get access
Grade+
$40 USD/m
Billed monthly
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers