delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/29/04:29:03

From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Weird : Segmentation fault on fwrite :(
Date: Sat, 29 Apr 2000 10:38:41 +0200
Organization: NetVision Israel
Lines: 30
Message-ID: <390A9F91.1EC37570@is.elta.co.il>
References: <956963090 DOT 719428 AT romulus DOT infonie DOT fr>
NNTP-Posting-Host: ras1-p56.rvt.netvision.net.il
Mime-Version: 1.0
X-Trace: news.netvision.net.il 956993909 29608 62.0.172.58 (29 Apr 2000 07:38:29 GMT)
X-Complaints-To: abuse AT netvision DOT net DOT il
NNTP-Posting-Date: 29 Apr 2000 07:38:29 GMT
X-Mailer: Mozilla 4.7 [en] (Win98; I)
X-Accept-Language: en,ru,hebrew
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

HPMAN wrote:
> 
> char TestBuff[32]="123456789012345678901234567890";
> FILE *output;
> 
> int main(void) {
> if((output=fopen("file.tst","wb"))==NULL) {
>     printf("Error Opening Output File, Exiting...\n");
>     exit(0);
> } else {
>         fwrite(&TestBuff,sizeof(char),32,output);
>         fclose(output);
>        }
> return(1);
> }
> 
> Well, this sample works (hard to do fewer things ;p)
> 
> The problem is I included this test pattern in my program causing problems,
> and it doesn't work (functions are enclosed between lots of other code of
> course, but remain 100% the same...
> 
> I got a segmentation fault : fwrite doesn't report an error, the program
> crashes at the call...

Since the test program above works, it is not useful for helping you find the
problem.

I suggest to read section 12.2 of the DJGPP FAQ list, and use techniques
described there to debug your problem.

- Raw text -


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