ide output delay with scanf() ?
BlitzMax Forums/BlitzMax Beginners Area/ide output delay with scanf() ?
| ||
| Hi, does anyone know why the output of a simple c printf() only appears in the MaxIDE output after the program closes? example:
#include <stdio.h>
int main()
{
char *s;
printf("%s","Hello sir\nWhat is your name?\nName:\n");
scanf("%s", &s);
printf("\nHi '%s'", &s);
}
The first printf is printed after the user input is finished. But MaxIDE fetches process output every 100ms so c seems to not write to stdout before the input is finished? But it works with C/C++ IDEs... This is not really relevant. I'm just curious. |
| ||
| what platform? you may want to try a fflush(stdout) after each printf |
| ||
| Happens on both windows and linux (probably mac as well). fflush(stdout) actually did the trick. |