
Problem with opening binary files using open()
B.) wrote in comp.lang.c:
=>Hi,
=>I'm using the function open() in a DOS program in the
=>following way:
=>
=> int fp;
=> fp=open(Filename,O_BINARY | O_RDONLY);
=>What I need to do is to open the binary files in the same
=>way as text files, just like the DOS editor does. The above
=>statement opens text files just fine, but reads garbage from
=>any binary files (using read()). Any suggestions?
open() is not ISO C and is implementation specific. Use fopen(). Then
use fread(). open() under MSVC does not offer any significant
advantage over using real C.
<><><><><><><><><><><><><><><><><><><><>
Wizard's First Rule:
People are stupid.
- Terry Goodkind
<><><><><><><><><><><><><><><><><><><><>