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.

2. Neither will the unix2dos program work since the file to open is a
binary file which must be read byte by byte.

3. fopen("test.dbh", "rb") seems to have nailed it. Since I require use of
lseek() later on, I need a file descriptor. So the solution (hack?) that
works is the following:
FILE *f = fopen("test.dbh", "rb");
int fd = fileno(f);

With that, the read(fd, data, 256) will read the correct amount of bytes.

Thanks!



-- 
------------------------------------------------------------------------------------
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