Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!rochester!cornell!batcomputer!pyramid!voder!apple!joemac From: joemac@apple.UUCP Newsgroups: comp.lang.c++ Subject: Re: bug in cout << ? Message-ID: <6782@apple.UUCP> Date: Thu, 19-Nov-87 14:18:11 EST Article-I.D.: apple.6782 Posted: Thu Nov 19 14:18:11 1987 Date-Received: Sat, 21-Nov-87 16:33:54 EST References: <807@gargoyle.UChicago.EDU> Reply-To: joemac@apple.UUCP (Joe MacDougald) Organization: Apple Computer Inc., Cupertino, USA Lines: 38 Keywords: bug ostream::operator<< My mailer barfed on a R to this address so here's my reply... in Article <807@gargoyle.UChicago.EDU> (Thomas F. McDougal) says: > > The offending code: > > cout << "Done doing something...\n"; > char* w; > > while (cin >> w) { > ... > cout << "Could not find: " > cout << w; > cout << "\n"; > } The problem here (besides the missing ';' after "Could not find: ") is that no store has been allocated for the characters read from cin. You have declared a char* but no real store. If you replace: char* w; with: char w[BUFSIZE]; // BUFSIZE in everything is hunky-dory. Hope this helps. joe | UUCP: {decwrl,sun,voder,amdahl,well,dual,unisoft}!apple!joemac | | Internet: joemac@apple.COM |