www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/03/29/12:29:31

Date: Tue, 29 Mar 1994 08:54:05 -0800
From: drupp AT cs DOT washington DOT edu (Douglas Rupp)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Binary file I/O

I'm having alot of trouble getting binary file I/O to work right.  I took
a working Unix program and ported it to DOS using DJGPP.  Since DOS has this
stupid TEXT/BINARY mode and the program deals with files of both types I
had to selectively annotate my "open" file calls with the BINARY attribute.
For example I have routines that do a generalized "append" of two existing
files together.  Since the "append" operation can be two text files or two
binary files, it made sense to always do it in binary for obvious reasons.

However as soon as I started using the BINARY mode, the O_TRUNC option stopped
working (on "open" w/o append) and the first record of every file and/or the
first appended record of every file gets written out with 2K of nulls.

What's going on?  Is this broken?

Doug Rupp
drupp AT cs DOT washington DOT edu

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019