delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/04/26/12:22:48

From: john AT rrci DOT com ("John D. Robertson")
Subject: Re: FILE I/O: fread() fails for GCC(Cygnus & DJ's) and TC++
26 Apr 1997 12:22:48 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <Pine.LNX.3.91.970426131748.10968A-100000.cygnus.gnu-win32@localhost>
Mime-Version: 1.0
X-Sender: john AT localhost
Original-To: Rich Kucera <Rich DOT Kucera AT ccmail DOT irs DOT gov>
Original-Cc: gnu-win32 AT cygnus DOT com
In-Reply-To: <0009386C.1950@ccmail.irs.gov>
Original-Sender: owner-gnu-win32 AT cygnus DOT com

I ran into the same problem myself using MSVC++ - spent half a day 
chasing it down.  The fix for me was to open the file in "binary" mode 
(whatever the hell that means!)

FILE *fh= fopen("yourfile", "rb");

Notice the mode is "rb", for read binary.

JDR

|======================================================|
| John D. Robertson, ADAMS Modeler / Software Engineer |
| Robertson & Robertson Consultants, Inc.              |
| 3637 West Georgia Rd.                                |
| Pelzer, SC  29669                                    |
|                                                      |
| Phone: (864) 243-2436                                |
|   Fax: (864) 243-3023                                |
| Email: john AT rrci DOT com                                 |
|======================================================|


-
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