I\'m trying to read a text file built with the following format in every line:
char*,char*,int
i.e.:
aaaaa,dfdsd,23
bbbasdaa,ffffd,100
Assuming you have:
char string1[20];
char string1[20];
int intA;
you could do:
fscanf(file, "%19[^,],%19[^,],%d\n", string1, string2, &intA);
%[^,]
reads a string of non-comma characters and stops at the first comma. 19
is the maximum number of characters to read (assuming a buffer size of 20) so that you don't have buffer overflows.