如何将 GPS 数据(txt 格式)里的经纬度提取出来?
$GPGGA,094444.00,3413.1211,N,11708.6596,E,1,11,0.9,67.59,M,-6.20,M,,*4D这是一条GPGGA格式的GPS数据,其中3413.1211和11708.6596是经纬度,如何提取出来保存到另一个txt文件中呢,c++编程实现,求大神帮助
gps.rar
(484 Bytes)
#include <cstdio> int main() { double a, b; if( 2 == sscanf( "$GPGGA,094444.00,3413.1211,N,11708.6596,E,1,11,0.9,67.59,M,-6.20,M,,*4D", "%*[^,],%*f,%lf,%*[^,],%lf", &a, &b ) ) printf( "%f %f\n", a, b ); return 0; }