RE: [Dev-C++] Examples using '\n' or endl
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <iv...@em...> - 2003-06-11 14:32:52
|
> -----Original Message----- > From: dev...@li...=20 > [mailto:dev...@li...] On Behalf=20 > Of Andr? Macario Barros > Sent: Wednesday, June 11, 2003 4:08 PM > To: Dev-Cpp-Users > Subject: [Dev-C++] Examples using '\n' or endl >=20 >=20 > Dear Users, >=20 > Can anybody give some examples of when I MUST use "endl"=20 > insted of '\n'? > When one is needed and when another? > Is endl used to clean the OUTPUT buffer Well endl also flushes the stream. The same thing like after printf() = you do fflush(stdout). I have met some coders out there that they = fflush(stdout) in C programs after some printf() calls to be sure that the messages = appeared before the program continues. I have never done that (flush stdout after printfs). So it is up to your judgement if you want to add an '\n' & = flush cout using only one 'endl'. >=20 > Note: The cin.ignore(200, =B4\n') worked fine. Thanks. Yes it ignores the next 200 characters or until '\n' is found before the 200th character. Ioannis Vranos =20 * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net |