I have a string to parse. This string has an almost-defined format with GPS coordinates. I want to get the coordinates.
Sometimes I have this :
09:24:29 N 012:34:35 W, 09:22:18 N 012:33:55 W
But sometimes I have extra whitespaces :
09:24:29 N 012:34:35 W , 09:22:18 N 012:33:55 W
But sometimes I have no whitespaces :
09:24:29 N 012:34:35 W,09:22:18 N 012:33:55 W
But sometimes I have decimal :
09:24:29.3 N 012:34:35.2 W, 09:22:18.1 N 012:33:55.6 W
So my question is : What's the most reliable and portable way to read these GPS coordinates in C ?
I first started with sscanf
, but I have a lot of issues with extra (or not) whitespaces and decimal .