I have an csv file and I want to get 2nd column's data. it is like that:
1st row: 4 8 6
2nd row: 3 2 2
3rd row: 7 7 5
I will add them into AVLTREE but main problem is how to get specially 2nd column's data? They delimited with semicolon.
4;8;6;
3;2;2;
7;7;5;
So far I have just this code
int main()
{
int c;
char buffer[1000];
FILE *f = fopen("file.txt", "r");
if(f == NULL)
{
printf("Error can't open file \n");
}
while (fgets(buffer,1000,f) != NULL)
{
char *p = strtok(buffer, ";");
while(p)
{
printf("%s\n", p);
p=strtok(NULL, ";");
}
printf("%c",c);
}
fclose(f);
}