delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/06/03/03:45:16

From: fjh AT cs DOT mu DOT OZ DOT AU (Fergus Henderson)
Subject: Re: fread/fwrite problems in b18
3 Jun 1997 03:45:16 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199706030919.TAA07856.cygnus.gnu-win32@mundook.cs.mu.OZ.AU>
Original-To: B DOT Amavasai AT sheffield DOT ac DOT uk (Bala Amavasai)
Original-Cc: gnu-win32 AT cygnus DOT com (Cygnus GNU-win32 mailing list)
In-Reply-To: <Pine.SUN.3.96.970602154737.29633A-100000@mozart> from "Bala Amavasai" at Jun 2, 97 04:03:08 pm
X-Mailer: ELM [version 2.4 PL24]
Original-Sender: owner-gnu-win32 AT cygnus DOT com

Bala Amavasai, you wrote:
> 
> Hi! I wonder if anyone can help.  I've written a short program to remove a
> fix sized header (of 512 bytes) from a raw image file. However when I
> compile it and run under gcc b18, I do not get the output I expect. That
> is the output file size is always 30 bytes.

Change your calls to fopen() to open the files in binary mode, e.g.
use `fopen(filename, "rb")' rather than `fopen(filename, "r")',
and similarly use "wb" rather than "w".  Or use binary mode mounts.

-- 
Fergus Henderson <fjh AT cs DOT mu DOT oz DOT au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh AT 128 DOT 250 DOT 37 DOT 3         |     -- the last words of T. S. Garp.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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