Mail Archives: djgpp/1999/07/01/08:59:22
should be fscanf(objFile,"%d",&points);
your trying to use the value in points as a poiter to the location to store
the value. This is probally 0
----- Original Message -----
From: David Mitchell <dmitchell AT inet DOT net DOT nz>
Newsgroups: comp.os.msdos.djgpp
To: <djgpp AT delorie DOT com>
Sent: Wednesday, June 30, 1999 5:22 AM
Subject: Files with GCC
> Could somebody tell me what is wrong with this code?
>
> int points;
> FILE *objFile;
>
> objFile = fopen(fname, "rt");
>
> fscanf(objFile, "%d", points);
>
> When I run this, my program crashes with this message:
>
> Exiting due to signal SIGSEG
> Page fault at eip=00005df6, error=0006
> eax=00000001 ebx=00066ac0 ecx=00066900 edx=001a41a0 esi=00001bcc
> edi=00000037
> ebp=00066a30 esp=000669b0 program=D:\DAVID\OBJ\A.EXE
> cs: sel=00a7 base=82dae000 limit=0007ffff
> ds: sel=00af base=82dae000 limit=ffffffff
> es: sel=00af base=82dae000 limit=ffffffff
> fs: sel=0087 base=0001c0a0 limit=0000ffff
> gs: sel=00bf base=00000000 limit=ffffffff
> ss: sel=00af base=82dae000 limit=ffffffff
>
> Call frame traceback EIPs:
> 0x00005df6
> 0x0000597a
> 0x00005743
> 0x00002b86
> 0x00001cbf
> 0x00002092
> 0x0000261a
>
> What's wrong? Sorry if this is a bit vague.
>
> David
>
>
>
>
- Raw text -