delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/03/03:00:33

Message-ID: <372D49A7.E145A3BA@cfwb.be>
Date: Mon, 03 May 1999 09:00:55 +0200
From: dominique DOT cretel AT cfwb DOT be (CRETEL Dominique)
X-Mailer: Mozilla 4.5 [en] (WinNT; I)
X-Accept-Language: fr,fr-BE,en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: I Need HELP QUICK, help please
References: <Sh2X2.3160$%W6 DOT 6264 AT wagner DOT videotron DOT net>
Reply-To: djgpp AT delorie DOT com


OmniMeta wrote:

> Can someone please tell me what is wrong in the lecture(int id)  function ?
>
> #define MaxETU 20
>
> struct Eleve
> {
>   char  nom[21];
>   char  code[6];
>   int   gr,n[4];
>   float moyenne,ecart;
> };
>
> Eleve  dat[MaxETU];
>
> int main()
> {
>   ...
>   ...
>   while(!lecture(i)=EOF)

!!!Warning here....
you do an affectation NOT a equality test...
you MUST write
    while (!lecture(i) == EOF)
or more readable
    while (lecture(i) != EOF)

>
>   ...
>
> }
> int lecture(int id)
> {
>   char tmp;
>   return fscanf(etu,"%20c%2d%3d%3d%3d%3d%c",
>          dat[id].nom, &dat[id].gr,  &dat[id].n[0],
>          &dat[id].n[1],&dat[id].n[2],&dat[id++].n[3],&tmp);
> }

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019