Menu

#323 read() function (of tdm64-gcc-5.1.0-2) not reading whole file if the file is binary (on Windows 10).

None
open
John E.
None
1
2018-01-02
2017-01-17
Anonymous
No

Hi,

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

BlueGem Technologies

3 Attachments

Discussion

  • Anonymous

    Anonymous - 2017-12-02
    Post awaiting moderation.
  • Anonymous

    Anonymous - 2018-01-01
    Post awaiting moderation.
  • Anonymous

    Anonymous - 2018-01-02
    Post awaiting moderation.

Anonymous
Anonymous

Add attachments
Cancel