|
From: Amit C. <ac7...@gm...> - 2017-12-31 08:12:18
|
I am facing a problem that when I try to read binary files on Windows 10, I am not able to read whole file. Does anyone else also faced same/similar problem. read() function (of tdm64-gcc-5.1.0-2) not reading whole file if the file is binary (on Windows 10). The gcc used is TDM-GCC-64 ( http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/tdm64-gcc-5.1.0-2.exe/download). The Windows platform is Windows 10. When I open a binary file in O_RDONLY mode, and then try to read it, the read() call returns "0" bytes even before reading the whole file. I tried with O_RDONLY | O_BINARY mode, read() call reads few more bytes than without O_BIANRY mode but it still does not read the whole file. It returns "0" bytes even before reading the whole file. I am attaching the source code (cat.c) and its executable (cat.exe) and a test binary file (cp.exe). I compiled cat.c using: gcc -static cat.c -o cat.exe Trying to read cp.exe: cat.exe cp.exe cat.c is attached in this mail. For cat.exe and cp.exe, please visit the webpage (bug filed with TDM-GCC): https://sourceforge.net/p/tdm-gcc/bugs/323/ |