Nymeria
Nymeria

Reputation: 5

alternative of fflush in C++

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.

Upvotes: 0

Views: 307

Answers (1)

DepletedKnowledge
DepletedKnowledge

Reputation: 80

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

Upvotes: 0

Related Questions