I'm studying "Headfirst C" and saw some code using [^\n]
.
Below is part of code, of which name is 'code.c'.
#include <stdio.h>
int main()
{
float latitude;
float longitude;
char info[80];
scanf("%f, %f, %79[^\n]", &latitude, &longitude, info) ;
printf("{latitude: %f, longitude: %f, info: %s}", latitude, longitude, info);
}
And What i want to do with this code is to read some data from data.cvs file and store it at 'latitude', 'longitude', 'info' and print it.
Below is gpsdata.cvs file
42.3634, -71.098465, Speed = 21
42.363327,-71.097588,Speed = 23
Result is supposed to be:
data=[
{latitude: 43.363400, longitudeL -71.098465, info: 'Speed = 21'}
I think this is related with [^\n]
thing is scanf
. What is it? I've never seen this before. Is it kinda new grammar of C11? Please help me!