home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!psuvax1!psuvm!gnr100
- Organization: Penn State University
- Date: Wed, 22 Jul 1992 16:00:15 EDT
- From: <GNR100@psuvm.psu.edu>
- Message-ID: <92204.160015GNR100@psuvm.psu.edu>
- Newsgroups: comp.lang.c
- Subject: While problem
- Lines: 18
-
- I'm having trouble with a whil loop in function I am writing to
- read a line from a fileby puttingeach character into an array, accesed by
- pionters, until the '\n' character is reached of EOF is reached.
- Trouble is, I keep getting an error message that the function needs an
- Lvalue (address) inside the while loop. Any ideas as to the problem?
- The filename is a global variable, and that's why it isn't declared.
-
- gnr100@psuvm.psu.edu
- ------------------------Begin Code-------------------------------------------
- char readline(char *string[])
- {
- int i=0;
-
- while(((*string+i++=(char)getc(fname))!=EOF)
- &&((*string+i++=(char)getc(fname))!='\n'));
- return (*string+(i-1));
- }
-
-