I want to substring and modify my string (which is defined below).
char gps[]="$GPGGA,115726.562,4512.9580,N,03033.0412,E,1,09,0,9,300,M,0,M,,*6E";
Shortly, I want to take and increase Lat,Long data which means
My steps
- Take lat info as char or float
- Convert lat(char) to float
- Add step value to float
- Convert lat(float) to char as newlat
- Insert newlat into gps[]
- printf
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[]