Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
#include <stdio.h>
int main()
{
int a;
printf("Hello!");
scanf("%d",&a);
return 0;
}
This writes "Hello!" to the screen and then waits for my input on Linux. On my OS, it writes nothing and then waits for input. The buffer only gets flushed when I print a newline character. Is there something I have to do on my end to make this happen?
Before reading from a line buffered or unbuffered file newlib will flush all line buffered output files. So, if your stdout is line-buffered and your stdin is NOT fully buffered it will flush automatically.
Can you check the buffer flags of stdin and stdout ?
[edit] my guess is that your isatty() is not implemented. It is used internally by newlib to decide which type of buffering to use.
If a trainstation is where trains stop, what is a workstation ?
Thanks. It turns out that isatty isn't getting called but fstat is. I guess it is using fstat to make that determination. I haven't implemented fstat yet.