Date: Sat, 17 Mar 2001 17:41:27 +0530 (IST) From: Mridul Muralidharan To: sager+@andrew.cmu.edu cc: Djgpp mailing list Subject: Re: Attempting to make an auto indenter In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sat, 17 Mar 2001, James W Sager Iii wrote: [snip] > I can't even get my program to read in a line without getting extra > Ascii gibberish. Anyone have the code to read in a line of text out of > an Ascii text file? My code looks like this: > [snip] > char *getline(FILE *f1) > { > //Assumes no line is greater than 256 characters > char c=0; > char line[256]; > int i; > //Loop while not end of line > i=0; > while(c!=10) > { > c=fgetc(f1); > if(c!=10) > line[i]=c; > i++; > } > line[i]='\0'; > return(line); > } here ,you are returning a local variable (array line)of function getline() function. use -Wall option in u'r gcc command line to get warnings like these reported. hope u finish u'r indent ( i may need it too ! ) Mridul Muralidharan S8 Electronics and Communication Regional Engineering College Calicut India ------------------------------------------------------------------------------ If the code and the comments disagree, then both are probably wrong. -- Norm Schryer All generalizations are false, including this one. -- Mark Twain /earth is 98% full ... please delete anyone you can. - fortune