Mail Archives: djgpp/1997/03/31/21:42:30
From: | av568 AT rgfn DOT epcc DOT edu (Beautiful Savior Lutheran Church)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: SIGSEGV when doing file operations
|
Date: | 31 Mar 1997 23:32:05 GMT
|
Organization: | The Rio Grande Free-Net, El Paso Community College, El Paso, TX
|
Message-ID: | <5hphhl$f5g@news.epcc.edu>
|
References: | <5hp58q$cn9 AT nexp DOT crl DOT com>
|
NNTP-Posting-Host: | rgfn.epcc.edu
|
Lines: | 27
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Kyle R. Hofmann (rhofmann AT crl DOT com) wrote:
> 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.
It's hard to tell what the problem is. On the surface, it looks like
you're trying to use a local pointer that has expired, but no one can be
sure without seeing the source.
--
Beautiful Savior Evangelical Lutheran Church - av568 AT rgfn DOT epcc DOT edu
We have what you need-- A Savior!
- Raw text -