home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!psinntp!npri6!murphy
- From: murphy@npri6.npri.com (David P. Murphy)
- Newsgroups: comp.lang.c
- Subject: Re: While problem
- Message-ID: <5967@npri6.npri.com>
- Date: 27 Jul 92 20:58:34 GMT
- References: <robertk.02w2@taoami.lerctr.org>
- Distribution: world
- Organization: NPRI, Alexandria VA
- Lines: 38
-
-
- > 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));
- > }
- >
- ><GNR100@psuvm.psu.edu>
-
- the answer has already been posted, so i feel primed to FLAME ON . . .
-
- can anyone explain to me how mr. gnr100 can have the gall to ask for help
- when his code is so deliberately obfuscated?
-
- DON'T max your code into as few characters as possible.
- DON'T push everything into a while loop.
- DO break it up over several lines --- i know, it'll hurt, but do it anyway.
- and DON'T come crying on the net for a stupid problem like this.
-
- ok
- dpm
- --
- murphy@npri6.npri.com 602 Cameron St. Alexandria, VA 22314 (703) 683-9090
-
- When every one is dead the Great Game is finished. Not before.
- --- Hurree Babu, "Kim"
-