Ok, thanks
P.S. That's why it is so recomended to put '\n' at the end of the printf statement...
Ok, thanks
P.S. That's why it is so recomended to put '\n' at the end of the printf statement...
Um no. Only if you want a new line on your screen. Otherwise don't.Originally posted by AProg
Ok, thanks
P.S. That's why it is so recomended to put '\n' at the end of the printf statement...
Quzah.
Hope is the first step on the road to disappointment.
What do you mean by "may"? What causes this "may" to occur?Originally posted by Prelude
Because there's no newline character printed and no call to fflush, the string may be placed in a temporary buffer because calling a low level write function to place the string directly onto stdout can be expensive.
Is it like a 50/50 thing? You'd think computers would be more exact.
Last edited by volk; 06-09-2003 at 06:51 PM.
>What do you mean by "may"? What causes this "may" to occur?
>Is it like 50/50 thing? You'd think computers would be more exact.
It depends on the host environment. Take a tiny example.I build this and run it in Visual SlickEdit's Build shell and I get a blank stare (no prompt). On the same machine I run it in a regular Windows command shell and I see the prompt. Same machine, same binary -- different hosts (can) do different things.Code:#include <stdio.h> int main(void) { printf("Press any key to continue..."); getchar(); return 0; }
"May" means the programmer didn't bother to ensure that a prompt should be seen - it was left up to the host to decide. If the programmer can't afford "may", then it's up to the programmer to be more exact.
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
Hmm.... I always thought that exiting a program automatically flushed all bufferes. Obviously there are some systems where thist is not true. I consider that very wierd, and non-friendly.
Definition: Politics -- Latin, from
poly meaning many and
tics meaning blood sucking parasites
-- Tom Smothers