From: "DeHackEd" Newsgroups: comp.os.msdos.djgpp References: <930735428 DOT 887115 AT kyle DOT inet DOT net DOT nz> Subject: Re: Files with GCC Lines: 36 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Message-ID: Date: Wed, 30 Jun 1999 12:40:25 GMT NNTP-Posting-Host: 142.194.222.157 X-Trace: cabot.ops.attcanada.net 930746425 142.194.222.157 (Wed, 30 Jun 1999 12:40:25 GMT) NNTP-Posting-Date: Wed, 30 Jun 1999 12:40:25 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com David Mitchell wrote in message news:930735428 DOT 887115 AT kyle DOT inet DOT net DOT nz... > Could somebody tell me what is wrong with this code? > > int points; > FILE *objFile; > > objFile = fopen(fname, "rt"); Is "fname" defined properly? Does the file really exist? Insert a test to make sure the file was opened successfully if (!objFile) { printf("File not opened successfully."); exit_in_a_better_way_than_crashing(); } > > fscanf(objFile, "%d", points); > > When I run this, my program crashes with this message: > > Exiting due to signal SIGSEG [snip] > > What's wrong? Sorry if this is a bit vague. > > David > It is also possible that this code is not the problem. For help on debugging the traceback, see the FAQ section 9.2. Just remember to compile your exe with the "-g" option.