Talk:cpp/utility/program/system
From cppreference.com
Hi,
where does the requirement that "an explicit flush of std::cout is also necessary before a call to std::system, if the spawned process performs any screen I/O" come from? And, if this is really a requirement, what is exactly meant by "screen I/O"? 95.245.142.168 01:29, 25 January 2021 (PST)
- it comes from experience. Here's a demo:
std::cout << "abc"; std::system("echo def"); // prints def\nabc std::cout << "\n"; std::cout << "123" << std::flush; std::system("echo 456"); // prints 123456\n
- Indeed, thanks! 87.5.60.74 00:45, 3 February 2021 (PST)