Hey guys. After taking the summer off of any type of coding... I'm picking up Kube (32-bit version) again.
Anyway, I'm trying to get newlib ported and am having a problem with printf.
If I use printf() in a test program and run it under my OS, it doesn't work unless I used exit() at the end of my main routine.
eg.
Code: Select all
int main()
{
printf("hello world");
printf("blah blah blah");
exit(0); <----------------- printf won't work without this. WHY? :(
}
I setup some debugging output in my syscalls to see what is being called. No system calls regarding printf are send out unless the exit(0) is called. It seems like printf is being buffered until exit is called. I am not doing any buffering in my code that's for sure. I've checked my print and write routines in libnosys and they work fine. If I use print("blah") instead of printf everything works as it should. Has anyone had this problem, or have any idea of what I may be overlooking?
[edit] ALRIGHT, if i fflush(stdout) after printf then it works, also a '\n' works. Duh.. I never knew this was standard operation... or is it?