read integer from file and save it into array

Posted by user1908123 on Stack Overflow See other posts from Stack Overflow or by user1908123
Published on 2012-12-16T16:56:15Z Indexed on 2012/12/16 17:03 UTC
Read the original article Hit count: 151

Filed under:

I have a file named plain.txt contain an integer for example 2500 I want to open this file and read the integer then compare it with another integer!! here I want to compare the value of plain text with K. how can I save the value of into another integer to compare??

int main(){
   int c,k=2000;
   FILE  *f;
   f=fopen("plain.txt", "r");
   c=getc(f);
   while(c!=EOF){
      putchar(c);
      c=getc(f);
   }
   fclose(f);

   return 0;
}

© Stack Overflow or respective owner

Related posts about c