我想子串并修改我的字符串(定义如下)。
char gps[]="$GPGGA,115726.562,4512.9580,N,03033.0412,E,1,09,0,9,300,M,0,M,,*6E";
不久,我想获取并增加 Lat,Long 数据,这意味着
我的脚步
- 将 lat 信息作为 char 或 float
- 将 lat(char) 转换为浮点数
- 将步长值添加到浮点数
- 将 lat(float) 转换为 char 作为 newlat
- 将 newlat 插入 gps[]
- 打印
char substr[10]; //4512.9580 //#number of char
memcpy(substr,&gps[19],10); //memcpy from gps char start from 19 take 9 char character
substr[10]='\0'; //I dont know what makes it
char lat[10]=??? //I dont know how I will take lat data
float x; //defined float value
x=atof(lat); //convert string to float
x=x+0.1; //add step value to float (4513.0580)
char newlat[10]; //newlat defined
sprintf(newlat,x); //convert to float to string
???? //I dont know how I can put into gps[]