home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16506 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  1.2 KB

  1. Path: sparky!uunet!usc!rpi!gatech!prism!federation!andy
  2. From: andy@federation.gatech.edu (Andy Register)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Can someone please help me with streams?
  5. Message-ID: <75249@hydra.gatech.EDU>
  6. Date: 18 Nov 92 14:33:29 GMT
  7. References: <1992Nov18.033505.1617@lugb.latrobe.edu.au>
  8. Sender: news@prism.gatech.EDU
  9. Organization: CERL-EE, Georgia Institue of Technology
  10. Lines: 17
  11.  
  12. In article <1992Nov18.033505.1617@lugb.latrobe.edu.au> ECSC9120802J@LUST.LATROBE.EDU.AU (GRANT,David) writes:
  13. |>
  14. |>I a new programmer to c++, and at the moment I am having trouble with streams.
  15. |>I have overloaded the istream operator >>, to read in character by charater and
  16. |>copy into an array. (It does a few other things as well.) The trouble I am
  17. |>having is that I can't get it to recognise spaces or carrage returns. It just
  18. |>seems to ignore them totally. I was wondering how I can get it to recognise
  19. |>these characters, as it is inportant to my program. 
  20. ----------------------------------------------------------
  21. Yep, istream ignores whitespace (blank, tab, newline, formfeed, cr).
  22.  
  23. Try cin.get() instead.  Stroustrup, The C++ programming language, 2nd
  24. ed., pp. 330-333 has examples.
  25.  
  26. Toodles
  27. Andy
  28.  
  29.