alternative of fflush in C++

294 Views Asked by At

I'm trying to find an alternative for fflush to clear the buffer in C++. I'm writing a C++ program to fork 3 children and print them in N loops but the O/P is not in correct order. Tried using cout<< flush and endl. Is there any other way to force the information to be displayed immediately? Thanks.

1

There are 1 best solutions below

0
On

It's not optimal but you can use getchar(); cin.get();