there we go that looks less insane :PCode:inline bool Flush_Stream(FILE* stream) { void* p = malloc(BUFSIZ); if (p == NULL) { return false; } else setbuf(stream, p); free(p); return true; }
sorry im anal about {} in if statements also you needed an else to be more clear what you wanted to happen in the if statement.



LinkBack URL
About LinkBacks



now i know what setbuf does YAY !
I wonder when people will realize that if you do things right to begin with, there's no need to "flush" the input stream.
What everyone failed to mention was that setbuf() must be called immediately after the stream is opened and before any i/o takes place. That pretty much makes the function unusable for stdin unless called at the start of the program in main(). passing NULL to setbuf() makes the stream unbuffered.