how can i parse a string using c -


given below string

char test[1000]="$gpgsa,a,3,14,20,22,25,31,32,,,,,,,2.4,1.4,1.9*3a     $gpgsv,4,1,16,31,76,060,35,14,28,070,34,20,32,309,32,32,61,309,32*72\n     $gpgsv,4,2,16,25,21,053,29,24,37,258,29,23,14,277,27,12,,,21*44\n     $gpgsv,4,3,16,22,13,133,20,11,20,272,,16,11,161,,30,,,*4f\     n$gpgsv,4,4,16,29,,,,28,,,,27,,,,26,,,*7e\n     $gpgga,150427.8,4001.022852,n,10505.269674,w,1,06,1.4,1559.6,m,-21.0,m,,*53\n     $pqxfi,150427.8,4001.022852,n,10505.269674,w,1559.6,35.12,25.46,2.05*4a\n     $gpvtg,nan,t,nan,m,0.0,n,0.0,k,a*23\n     $gprmc,150427.8,a,4001.022852,n,10505.269674,w,0.0,,280611,,,a*50"; 

i want string

"$gpgga,150427.8,4001.022852,n,10505.269674,w,1,06,1.4,1559.6,m,-21.0,m,,*53\n" 

from above big string using c language.

please me out.

you line want, didn't why. if line makes line after, comment on how you'd find it.

but basically, you'll want separate string lines. can use strtok() break on \n. can examine lines, 1 @ time.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -