Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!bellcore!faline!ulysses!allegra!alice!ark From: ark@alice.UUCP Newsgroups: comp.lang.c++ Subject: Re: bug in cout << ? Message-ID: <7464@alice.UUCP> Date: Thu, 19-Nov-87 11:27:26 EST Article-I.D.: alice.7464 Posted: Thu Nov 19 11:27:26 1987 Date-Received: Sat, 21-Nov-87 19:20:00 EST References: <807@gargoyle.UChicago.EDU> Distribution: na Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 36 In article <807@gargoyle.UChicago.EDU>, mcdougal@gargoyle.UUCP writes: > The offending code: > cout << "Done doing something...\n"; > char* w; > > while (cin >> w) { > ... > cout << "Could not find: " > cout << w; > cout << "\n"; > } w doesn't point anywhere, yet you're reading into it! You might replace char* w; by char w[200]; or some suitably large buffer. Of course, what you'd really like to be able to say is String w; while (cin >> w) { ... }; and have the String class take care of memory allocation for you. This is left as an exercise to the reader.