delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/06/20/05:20:51

To: "Marty Leisner" <leisner AT sdsp DOT mc DOT xerox DOT com>
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: O_TEXT/O_BINARY grief
Date: Mon, 20 Jun 94 11:08:36 +0300
From: eliz AT is DOT elta DOT co DOT il

> I've shuffled hundreds of programs over the years this way between
> MS-dog and Unix and I never saw anything bad happen...

This means you either (1) used fscanf() to read the files, or (2) the default
mode for open() in your compiler is TEXT, or (3) you work with files which
come from Unix unchanged and don't have those extra CRs.  In the latter case
try to edit the file with any DOS-based editor (not Emacs!) and see what
happens.

Btw, I agree that *most of the time* the ``don't care'' approach works, and if
it does, the code should be left alone to facilitate portability and
maintainability.  But watch for programs like GNU Diff which read() the whole
file and then search for Newlines inside the buffer, etc.  Another problem would
be text files which came from DOS-based editors who add ^Z character as the
end-of-file marker.  It is *not* nice, IMHO, for a program to bomb on such files
under the notion of ``get real OS/editor, dude''.  Checking a program for such
gotchas is NOT trivial, and that is what makes a port to DOS a pain in the neck.

	Eli Zaretskii

- Raw text -


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