www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/21/10:59:58

Message-Id: <335B7D8F.26D3@canvaslink.com>
Date: Mon, 21 Apr 1997 10:45:35 -0400
From: Tom Grandgent <tgrand AT canvaslink DOT com>
Reply-To: tgrand AT canvaslink DOT com
Organization: Canvas Link, Inc.
Mime-Version: 1.0
To: brianp AT ic DOT owatonna DOT mn DOT us
Cc: djgpp AT delorie DOT com
Subject: Opening a file as text vs. binary

> Well, to make a long story short, I looked at the "compiled" code in a
> hex editor, and after about a week of searching for some determinable
> pattern, I have concluded that every time a byte 10 is produced, a 13
> is tacked before it, which throws off the code offsets.

Well, your problem sounds similar to one that I once had back when I
used Borland C++ 3.1.  You've probably checked for this already, but
are you sure you're opening the file in binary mode?  I'm pretty sure
if you opened it in text mode it would do what you're describing.

fp = fopen("bogus.map", "w");   // bad..

fp = fopen("nice.map", "wb");   // good..

Hope this helps,

	Tom Grandgent
	tgrand AT canvaslink DOT com
	Canvas Link, Inc.

- Raw text -


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