Path: utzoo!attcan!uunet!mcvax!hp4nl!targon!andre From: andre@targon.UUCP (andre) Newsgroups: comp.unix.wizards Subject: Re: Unix problem or C problem? Message-ID: <498@targon.UUCP> Date: 19 Jan 89 15:03:55 GMT References: <245@ibd.BRL.MIL> Reply-To: andre@targon.UUCP (Andre van Dalen) Organization: Nixdorf Computer BV., OSP, P.O. Box 29,Vianen, The Netherlands Lines: 22 In article <245@ibd.BRL.MIL> heilpern@brl.arpa (Mark A. Heilpern (IBD) ) 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