> Hi
>
> I am probably posting more noise, but shouldnt the code below print
> the prompt first then ask for a char? It works fine under gcc.
>
>
> #include <stdio.h>
>
> int main()
> {
> printf("\nprompt");
> getchar();
> return 0;
> }
the output is buffered. i don't see a requirment to flush
stdout or any other output stream in c99 or posix standard for
fgetc, though i may have missed something. getchar is
defined in terms of fgetc. i would think this code would
reliably do what you wish:
#include<stdio.h>
int
main(void)
{
printf("\nprompt");
fflush(stdout);
getchar();
return 0;
}
- erik