I'm trying to read a file line by line and getting a total of 6 variables from it on each line starting with a string followed by 5 ints The problem is everytime I try this the initial string just keeps the whole line and the ints are left with random numbers. so is there a way to stop that initial string on the 1st ";". The variables on the file are writen as: string;V1;V2;V3;V4;V5
FILE *fp;
fp = fopen("MP.txt","r");
char tipo[20];
int V1,V2,V3,V4,V5;
while(!feof(fp)){
fscanf(fp, "%s;%d;%d;%d;%d;%d", tipo,&V1,&V2,&V3,&V4,&V5);
printf("\n%s\v1:%d\V2:%d\V3:%d\V4:%d\V5:%d\n",tipo,V1,V2,V3,V4,V5);
}
I've also tried to add %[^;]
after the string which I saw on a comment but it didn't work.
Also the initial string on the file has a different size on each line.