std::async not letting std::cout print to terminal

Hi, I tried out the code found here
http://www.cplusplus.com/reference/future/future/wait_for/

When I run it on my machine, I don't get any output whatsoever before the std::async is finished. Once it it's done, I do get the correct amount of dots so I presume the while loop is reached while the std::async is still executing.

Why is std::cout getting blocked?
To print out the character to the console immediately, flush the stream.
See: https://en.cppreference.com/w/cpp/io/manip/flush

1
2
3
// *** modify line 21 ***
// std::cout << '.';
std::cout << '.' << std::flush ;
Thanks! Fixed it
Topic archived. No new replies allowed.