I am creating a small tool that reads csv file data which has got to read longitude,latitude and info from a csv file and write it to another file in java script object notation.
Example:
42.363400, -71.098465, Speed = 21
42.363327, -71.097588, Speed = 23
Now I know I can read whole line first,then search for , and pick each data,assign it to individual variables.
But I want to know is there any way using scanf to fetch the data to variables at one stretch.I am using scanf like this now:
scanf("%f %f %100[^\n]s",&latitude,&longitude,info);
Can we tweak in scanf to get this done?
simply place the comma where required: remember also that a single space matches a sequence of 0 or more blanks: