Help with reading from file

Hello there i have a textfile that goes like this:

@Solomon Islands

AGAF (AFT)

AGAR (RNA)

AGAT (ATD)
AGBA

And I need to write a function in order to do these:
country SolomonIslands
code AGAF
zipcode (AFT)
but i cant manage it.

So far i have made this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
void GetStats(FILE *Input){
char s;
char *country,*code,*zipcode;
    while(!feof(Input)
    {
      fscanf(in,"%c",&s);
      if(c=='@') fscanf(Input,"%s",&country);
//i dont know how to make file pointer go to new line 
//and i cant use the same technique as above..
//because i will lose some letters
    }
}



Last edited on
Topic archived. No new replies allowed.