sscanf

取字符串时候很有用:http://hi.baidu.com/pursuitofacm/item/d1e5ecfe93055804ff358230

char* gpsinfo="$GPRMC,123456.78,A,2308.28715,N,11322.09875,E,0.195,123.1,240213,,,A*78";

sscanf(gpsinfo, "%[^,],%[^,],%[^,],%[^,],%[^,]",store,store2,store3,store4);

store=$GPRMC  store2=123456.78  store3=A  store4=2308.28715

sscanf(gpsinfo, "$%[^,],%[^,],%[^,],%[^,],%[^,]",store,store2,store3,store4);

store=GPRMC  store2=123456.78  store3=A  store4=2308.28715

sscanf(gpsinfo, "%*[^,],%[^,],%[^,],%[^,],%[^,]",store,store2,store3,store4);

store=123456.78  store2=A  store3=2308.28715  store4=N

原文地址:https://www.cnblogs.com/wwjdwy/p/3681143.html