2013/10/16 Ruben Van Boxem <vanboxem.ru...@gmail.com>

> 2013/10/16 Edscott Wilson <edscott.wilson.gar...@gmail.com>
>
>>
>> I appreciate all the responses. This is the result.
>>
>> 1. The option O_BINARY is not available in fcntl.h for gcc, So
>> open("test.dbh", O_RDWR|O_BINARY) does not work.
>>
>
> See MSDN for the flags you are looking for:
> http://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx
>
>
>
The problem with that is I want to use mingw-64's gcc, and gcc does not
define O_BINARY, and does not seem likely that it will in the future. Maybe
the mingw port should include O_BINARY and O_TEXT.

Funny thing is that fread() and fwrite() assume a binary stream, even if
FILE is not opened with the "b" flag. (
http://manpages.courier-mta.org/htmlman3/fread.3.html) whileas read() and
write() do not make that assumption (http://linux.die.net/man/2/read). That
was why the test program could correctly read the binary file with fread()
(opened without the "b" flag), but read() failed miserably.

I do not see any reason why read() and write() should not assume binary
input/output just as fread() and fwrite() do.

-- 
------------------------------------------------------------------------------------
Dr. Edscott Wilson Garcia
Applied Mathematics and Computing
Mexican Petroleum Institute
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to