[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: The contents of the file is not read..



> i'm a beginner in C.  I used the following code to read and print the strings 
> in  a file. but  the control doesn't reach inside the while loop. what is the 
> problem?
EOF == -1 and do not jump into the while loop

> FILE *FilesRead=fopen("FilesRead.txt","r");
>    if(!FilesRead)
>        printf("File not opened");
>    else
>        printf("Opened file");
>    while(!EOF)
while(fscanf(FilesRead, "%s", name_read) != EOF)
>    {
>        fscanf(FilesRead,"%s",name_read);
>        printf("%s",name_read);
>    }
>    fclose(FilesRead);

CU        
         
  Michael  
          
-- 
    ,''`.   Michael Ott, e-mail: michael at zolnott dot de
   : :' :   Debian SID on Thinkpad T43: 
   `. `'    http://www.zolnott.de/laptop/ibm-t43-uc34nge.html 
     `-     
Jeden Mittwoch von 21 - 24 Uhr. Zosh! auf Radio Z. 
Das Härteste, was der Musikmarkt zu bieten hat. http://www.zosh.de
Online hören: http://www.radio-z.net 



Reply to: