Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!brl-adm!rutgers!princeton!allegra!alice!bs From: bs@alice.UUCP Newsgroups: comp.lang.c++ Subject: Re: flush() Message-ID: <6473@alice.uUCp> Date: Mon, 15-Dec-86 09:05:34 EST Article-I.D.: alice.6473 Posted: Mon Dec 15 09:05:34 1986 Date-Received: Wed, 17-Dec-86 18:47:05 EST Distribution: comp Organization: AT&T Bell Laboratories, Murray Hill NJ Lines: 32 Summary: curious In article <8327@watrose.UUCP>, gjditchfield@watrose.UUCP writes: > The following program results in an error message from cc (not CC). > > #include> main() { > char c; > while ( cin.get(c) ) cout << c; > cout.flush(); > } > > cc claims that line 5 (cout.flush()) is an illegal function. Help! > -- Curious. It compiled and ran here. I think you will have to look for a bug in your port. There is, however, two observations I can make: (1) the explicit call of flush is redundant since the ostream destructor will be called implicitly for cout, and it will do the flush. (2) are you really trying to write a program that converts a stream of characters into a stream of digits (the digits in the integer representation of the characters)? In ``cout << c;'' ``c'' is implicitly converted to an integer. The character by character copy program looks something like this: main() { char c; while (cin.get(c)) cout.put(c); }