home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / c / 11661 < prev    next >
Encoding:
Internet Message Format  |  1992-07-27  |  1.7 KB

  1. Path: sparky!uunet!psinntp!npri6!murphy
  2. From: murphy@npri6.npri.com (David P. Murphy)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: While problem
  5. Message-ID: <5967@npri6.npri.com>
  6. Date: 27 Jul 92 20:58:34 GMT
  7. References: <robertk.02w2@taoami.lerctr.org>
  8. Distribution: world
  9. Organization: NPRI, Alexandria VA
  10. Lines: 38
  11.  
  12.  
  13.  >    I'm having trouble with a whil loop in function I am writing to
  14.  > read a line from a fileby puttingeach character into an array, accesed by
  15.  > pionters, until the '\n' character is reached of EOF is reached.
  16.  >   Trouble is, I keep getting an error message that the function needs an
  17.  > Lvalue (address) inside the while loop.  Any ideas as to the problem?
  18.  > The filename is a global variable, and that's why it isn't declared.
  19.  >
  20.  >                 gnr100@psuvm.psu.edu
  21.  > ------------------------Begin Code-------------------------------------------
  22.  > char readline(char *string[])
  23.  > {
  24.  >   int i=0;
  25.  >
  26.  >   while(((*string+i++=(char)getc(fname))!=EOF)
  27.  >       &&((*string+i++=(char)getc(fname))!='\n'));
  28.  >   return (*string+(i-1));
  29.  > }
  30.  >
  31.  ><GNR100@psuvm.psu.edu>
  32.  
  33. the answer has already been posted, so i feel primed to FLAME ON . . .
  34.  
  35. can anyone explain to me how mr. gnr100 can have the gall to ask for help
  36. when his code is so deliberately obfuscated?
  37.  
  38. DON'T max your code into as few characters as possible.
  39. DON'T push everything into a while loop.
  40. DO break it up over several lines --- i know, it'll hurt, but do it anyway.
  41. and DON'T come crying on the net for a stupid problem like this.
  42.  
  43. ok
  44. dpm
  45. -- 
  46. murphy@npri6.npri.com 602 Cameron St. Alexandria, VA 22314 (703) 683-9090
  47.  
  48.               When every one is dead the Great Game is finished.  Not before.
  49.                               --- Hurree Babu, "Kim"
  50.