http://bugs.winehq.org/show_bug.cgi?id=26914
Summary: setvbuf() breaks iostream input (msvcrt/msvcp) Product: Wine Version: 1.3.17 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown AssignedTo: wine-bugs@winehq.org ReportedBy: UncombedCoconut@gmail.com
This bug affects Stockfish, a chess engine. I've made a simplified test case.
This C++ program copies a line from stdin to stdout, or complains on EOF. It works on WinXP, but under Wine 1.2.2 or 1.3.17 it says "No input". (You do have to type a line before it will terminate.)
Here's the code and build command. The exe is attached. $ cat setvbuf-test.cpp #include <iostream> #include <cstdio> #include <string>
int main() { std::string input; setvbuf(stdin,NULL,_IONBF,0); setvbuf(stdout,NULL,_IONBF,0); if (std::getline(std::cin, input)) std::cout << "Input was: " << input << "\n"; else std::cout << "No input\n";
return 0; }
$ i686-w64-mingw32-g++ -o setvbuf-test.exe -static-libgcc setvbuf-test.cpp