make one string from 2 strings.
hello
i managed to parse the parts that i need from this string:
Code:
"GET /send.htm?Text=START+00500+11611 HTTP/1.1"
with this pair of code ( with help of this forum :) ):
Code:
char Text[80] = {0};
char * line = "GET /send.htm?Text=START+00500+11611 HTTP/1.1";
char *s,*t;
char bt_msg[20] = {0};
if(s = strchr(line, '+'))
{
if(t = strchr(s, ' '))
strncpy(Text, s+1, t-s);
}
char *xcoord=strtok(Text,"+"), *ycoord=strtok(NULL,"+");
printf("x-coord:%s\n", xcoord);
printf("y-coord:%s\n", ycoord);
}
so basically:
the output will be:
Code:
x-coord: 00500
y-coord: 11611
i need to assemble a payload that follows the following structure:
than means the first five digits represent the x-coord and the 2nd five digits represent y-coord.
i need to save assemble this payload from those coordinates and put in a variable so i can use it later on.may be save it as bt_msg. how could i do it?
thanks :)