Soldato
- Joined
- 10 Apr 2004
- Posts
- 13,497
Ok, been trying with no luck to do this for a while now...:
File line format:
$DATA,123550.000,8108.0053,N,1007.000,....
Code is:
sscanf(string1, "%[^','],%f,%f,%n,%f",&nmea_ident,&time[ii],&latitude[ii],&longditude[ii]);
Gives me:
$DATA, 123550.000, 8108.0053, 0.000
Now its trying to scan in the "N" between the latitude and longditude, i've searched and tried many different things with no luck.
I want it to ignore the N and import the value after it into the longitude array.
Anybody tell me how I tell it to ignore stuff between commas?
Cheers!
Edit:
Ok I've cheated and just added a char variable to swallow it, bodge but hey it works until you lot think of something better
In addition to the above:
I need to split "123550.00" which is 12:35:55 so hours:mins:seconds.
Is there a way of doing that when reading from the string to the variables or should I read it in as a string and do something else with it?
If you could just tell me the commands I need with a hint or two that would be great (its university work so I'd rather fiddle myself instead of getting others to do it!)
Cheers
File line format:
$DATA,123550.000,8108.0053,N,1007.000,....
Code is:
sscanf(string1, "%[^','],%f,%f,%n,%f",&nmea_ident,&time[ii],&latitude[ii],&longditude[ii]);
Gives me:
$DATA, 123550.000, 8108.0053, 0.000
Now its trying to scan in the "N" between the latitude and longditude, i've searched and tried many different things with no luck.
I want it to ignore the N and import the value after it into the longitude array.
Anybody tell me how I tell it to ignore stuff between commas?
Cheers!
Edit:
Ok I've cheated and just added a char variable to swallow it, bodge but hey it works until you lot think of something better

In addition to the above:
I need to split "123550.00" which is 12:35:55 so hours:mins:seconds.
Is there a way of doing that when reading from the string to the variables or should I read it in as a string and do something else with it?
If you could just tell me the commands I need with a hint or two that would be great (its university work so I'd rather fiddle myself instead of getting others to do it!)
Cheers
Last edited: