home bbs files messages ]

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,230 of 33,346   
   Seungbeom Kim to Ralf Fassel   
   Re: Help with C++ Primer exercise 8.1   
   05 Oct 13 04:43:53   
   
   From: musiphil@bawi.org   
      
   On 2013-10-04 15:28, Ralf Fassel wrote:   
   > * nvangogh    
   > | 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.   
   >   
   > Keep in mind that an istream is not necessarily connected to a   
   > terminal (as you imply with "Control-d") .  It could also be a plain   
   > file, a network socket, or just anything else which delivers input   
   > via an rdbuf.   
   >   
   > So just check the eof() member function of istream.   
      
   Just keep in mind that "until it hits EOF" is NOT "while   
   (!cin.eof())"; eof() means "in previous operations we have encountered   
   the end of input", so what it says is not whether a future read will   
   fail, but rather why a previous read failed (meaningful only after a   
   read operation).   
      
   --   
   Seungbeom Kim   
      
      
         [ 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