Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 33,226 of 33,346    |
|    nvangogh to All    |
|    Help with C++ Primer exercise 8.1    |
|    04 Oct 13 09:56:57    |
      From: nvangogh@invalid.net              I am reading C++ Primer 5th edition and am having problems with exercise       8.1:              "Write a function that takes and returns an istream&. The function       should read the stream until it hits end-of-file. The function should       print what it reads to the standard output. Reset the stream so that it       is valid before returning the stream."              So just to break this down, the function should:              1. read the stream until it hits EOF.       This mean that I am inputting data until I signal the end of input by       control-d.              2. The function prints what it reads to the standard output.       This is simply std::cout << whatever is input?              3. How can the function reset the stream before returning the input?              IO in C++ is very complicated that is why I am asking for help       What is the solution to this?                     --        [ See http://www.gotw.ca/resources/clcm.htm for info about ]        [ comp.lang.c++.moderated. First time posters: Do this! ]              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca