I wrote a program to read binary floating point data from std::cin.
- Code: Select all
std::cin.read( (char*) &val, sizeof(float) );
std::cerr << "Value= " << val << std::endl;
Then I compiled it under cygwin using
> g++ prog.cc
Then I executed it using
> ./a.exe < data.rsf
where data.rsf contains an ascii header followed by thousands of floating point data values written in binary.
So, far things were fine and the resulting exe file works perfect.
Then I wanted to have a native windows executable and therefore compiled the same code without using cygwin libraries using
> g++ -mno-cygwin prog.cc
This time, the resulting exe reads a few data values and then terminates as it unexpectedly finds EOF.
Can anybody explain why this native windows executable fails to read binary data from std::cin. Does my mingw need extra libraries?
Thanks in advance,