What is wrong with my code? The first line is correct from input.txt but the second is broken, and I don't know why date spends a line. Why do elements pack and method pick a date?
My code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, const char * argv[]) {
    FILE *fr;
    char date[11];
    char pack[3], method[4];
    fr = fopen("input.txt","r");
    if(fr == NULL)
        printf("File not found\n");
    while(!feof(fr)) {
        fgets(date,11,fr);
        fgets(pack, 3, fr);
        fgets(method, 4, fr);
        printf("%s %s %s",date,pack,method);
    }
    fclose(fr);
    return 0;
}
My input.txt:
2015-05-01 A GG
2015-05-02 H GG
2015-05-03 H AA
2015-05-05 G SS
2015-05-06 D GG
2015-05-17 V GG
2015-05-24 AAAAA
2015-05-29 V GG
2015-06-01 V GG
And maybe somebody knows how to read the date format (not like in my code) from a file, and how to check if it is the next month or not?
 
     
    