Thread: How to avoid repeating

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    58

    How to avoid repeating

    Code:
    if ( ( fp = fopen( "list.txt", "r" ) ) == NULL )
                                 {
                                      printf("File does not exist. \n");
                                      system ("pause");
                                 }
                                 else
                                 { 
                                     while (!feof((fp)))
                                     {
                                     
                                     fscanf( fp, "%s %s", student.surname, student.name);
                                     printf("%s %s\n", student.surname, student.name);
                                     }
    Hello. When i reading my .txt i am getting last record 2 times. The question is how to avoid repeating.

  2. #2

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Repeating Decimals
    By jaypeebee18 in forum C Programming
    Replies: 11
    Last Post: 08-03-2008, 09:47 AM
  2. Repeating a String in C
    By Keegan in forum C Programming
    Replies: 11
    Last Post: 11-16-2007, 11:46 AM
  3. repeating a function
    By Mythic Fr0st in forum C++ Programming
    Replies: 2
    Last Post: 01-17-2007, 10:32 PM
  4. repeating strings
    By h_howee in forum C++ Programming
    Replies: 9
    Last Post: 11-29-2006, 12:30 AM
  5. What the? Loop repeating to much?
    By Blackroot in forum C++ Programming
    Replies: 4
    Last Post: 02-03-2006, 05:17 PM