Unix problem or C problem?

andre andre at targon.UUCP
Fri Jan 20 01:03:55 AEST 1989


In article <245 at ibd.BRL.MIL> heilpern at brl.arpa (Mark A. Heilpern (IBD) <heilpern>) writes:
>	while (fscanf(input,"%d",stars)!=EOF) {
>		fprintf(stderr,"OK to this point.\n");

>PROTECTION VIOLATION: name='plot', pid=15943, pc=a410cdc, ps=80000180

I think this is a C problem namely yours. If you want scanf to fill
an integer for you, you must supply a pointer to that integer and
not the value of the integer so if you make your code to be:

	while (fscanf(input,"%d", &stars)!=EOF) {
		YOU FORGOT THIS _/^

the problem will go away.

	Hope this helps. Andre.

-- 
~----~ |m    AAA         DDDD  It's not the kill, but the thrill of the chase.
~|d1|~@--   AA AAvv   vvDD  DD        Segment registers are for worms.
~----~  &  AAAAAAAvv vvDD  DD
~~~~~~ -- AAA   AAAvvvDDDDDD        Andre van Dalen, uunet!mcvax!targon!andre



More information about the Comp.unix.wizards mailing list