I was writing a program that had an infinite loop,
while (1) , and within that loop was an if statement checking to see if a certain amount of time had passed. If it did, it would print out something, if it didn't, it would print out a '.'. Well the message got printed out fine but the dots did not get printed until I terminated the program.
To fix it, I researched ostream and found the function
flush() . Before my
cout << '.' i put the
flush(); statement and to my surprise it solved the problem perfectly. Why wasn't it working before? I've had this problem before and I was wondering if it's just a common programming fallacy, I'm assuming I just had something weird on the buffer but I don't know what...maybe when I cout'ed one of my strings before?