www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/31/18:22:31

From: "Kyle R. Hofmann" <rhofmann AT crl DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: SIGSEGV when doing file operations
Date: 31 Mar 1997 20:02:34 GMT
Organization: CRL Dialup Internet Access (415) 705-6060 [Login: guest]
Lines: 24
Message-ID: <5hp58q$cn9@nexp.crl.com>
NNTP-Posting-Host: crl10.crl.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm trying to use fread to read in parts of a file, and it segfaults 
every time.  What I do is:

Call my function OpenFile, which:
-Opens the file.
-Reads 4 bytes using fread() and checks if they are what they should be.
-Reads 4 more bytes using fread() and stores them.
-Returns.
Call my function ReadData, which promptly crashes when doing anything 
file related.

I've done various things at the point where it crashes, and so far fread(), 
fseek(), ftell(), and even fclose() all die at that point.  This is 
_very_ annoying, especially since another program I tried compiling that 
does file I/O works fine.  Symifying the tracebacks gives me _fread+22, 
_fseek+20, _ftell+9, and _fclose+28 as the places where it dies.  I tried 
moving the fopen out of OpenFile and into main(), but that causes it to 
crash at ___dj_movedata+33, called from _fread+129.

--
Kyle R. Hofmann <rhofmann AT crl DOT com>

"We've never done a piece of software unless we thought it would sell."
-- Bill Gates

- Raw text -


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