delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/18/23:07:02

Message-ID: <34726566.7BE99635@ibm.net>
Date: Tue, 18 Nov 1997 23:04:57 -0500
From: Elvis Dieguez <elvisum AT ibm DOT net>
MIME-Version: 1.0
To: DJGPP Mail Group <djgpp AT delorie DOT com>
Subject: Scanf Function and EOF

I am learning how to program in C and I have the following problem:
    I wrote a simple While-loop that scans in some strings until the EOF
marker is reached (or Cntrl-D is pressed).  The loop works correctly
when compiled on a Unix compiler but refuses to do so when compiled with
DJGPP.  According to my text book, the scanf function returns EOF when
it reaches the end of the line or an error occurs.  That seems to me to
be the problem.... I am not sure though.. and would appreciate some help
ASAP because this project is due next week...

Thank You,

Elvis Dieguez
PS  I read the FAQ but I did not find anything to help me....
PPS  Here is the loop:
                                  while( scanf("%s", array[i]) != EOF){
                                            ++i;
                                            }



- Raw text -


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