www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/10/23:00:46

From: triplez AT singnet DOT com DOT sg (tripleZ)
Newsgroups: comp.os.msdos.djgpp
Subject: Help with EOF
Date: Sat, 10 Jul 1999 17:06:06 GMT
Organization: Singapore Telecommunications Ltd
Lines: 28
Message-ID: <37877c8f.2555669@news.smartnet.com.sg>
NNTP-Posting-Host: news.smartnet.com.sg
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

i've got a problem with EOF.. here's the code

<snip>

file = fopen ("records.txt","r");

 while (!EOF(file))
 {
  fscanf(file, "%d %d %d\n", n1, n2, n3);
  if (n3 == key)
  {
   g_class = n1;
   g_student = n2;
   fclose(file);
   return 0;
  }
  else
  {
   fclose(file);
   return -1;
  }
 }

<snip>

okay... the error is... '-1' cannot be used as a function
so how do i make this while loop work?

- Raw text -


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