www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/28/19:12:59

From: "HPMAN" <mwa DOT p AT infonie DOT fr>
Newsgroups: comp.os.msdos.djgpp
Subject: Weird : Segmentation fault on fwrite :(
Date: Sat, 29 Apr 2000 01:01:33 +0200
Organization: Ye 'Ol Disorganized NNTPCache groupie
Lines: 43
Message-ID: <956963090.719428@romulus.infonie.fr>
NNTP-Posting-Host: romulus.infonie.fr
X-Trace: vulcain.infosources.fr 956962869 16502 195.242.64.111 (28 Apr 2000 23:01:09 GMT)
X-Complaints-To: abuse AT infonie DOT fr
NNTP-Posting-Date: 28 Apr 2000 23:01:09 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Cache-Post-Path: romulus.infonie.fr!unknown AT 195 DOT 242 DOT 67 DOT 27
X-Cache: nntpcache 2.4.0b3 (see http://www.nntpcache.org/)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi everyone !!!

I got some weird problem when using fwrite in DJGPP.

Look at this simple sample :

#include <stdio.h>

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...

I'm really don't know what to think about this...

Does anybody knows reasons to get an seg fault on an fwrite call ?!?


That's plain weird...


Thanks for help !!!


- Raw text -


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