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,ddd,100
i want to use fscanf to read a line from file, and automatically parse the line into the varilables string1,string2,intA
What’s the correct way of doing it ?
Thanks
Assuming you have:
you could do:
%[^,]reads a string of non-comma characters and stops at the first comma.19is the maximum number of characters to read (assuming a buffer size of 20) so that you don’t have buffer overflows.