Some days ago i started a thread. concatenation of non constant character array with a sting
I have a different question but on the same nature (string and chars)
what i want is one variable (string or char) that will hold a standard text and the value of gps coordinates latitude and longitude
The format is this: "latitude/longitude: 30.111111 20.111111"
What i have is a char that holds the standard text and the latitude: "Latitude/Longitude: 30.111111"
I also have another char that holds the second value (longitude)
The chars were generated with dtostrf():
char clat[10 + 20 + 1] = "Latitude/Longitude: "; char clng[10 + 1]; dtostrf(gps.location.lat(), 10, 6, clat+20); dtostrf(gps.location.lng(), 10, 6, clng);
I can also make the chars strings:
string1 = String(clat);
What have i tried: 1.Assigning clng to clat directly via dtostrf()
char clat[10 + 20 + 10 + 1] = "Latitude/Longitude: "; dtostrf(gps.location.lng(), 10, 6, clng+31);
It didnt work and got unexpected output
making clat a string and assign clng via for loop
string1 = String(clat); for (int i=0; i<10; i++) string1[i+32]=clng[i];
This doesnt append it
I run out of ideas here. Any help from more experienced guys?