Could any one help me to solve this problem?: I want to print the URL correctly ,so I need to print latitude and longitude without white spaces
float la = sim808.GPSdata.lat;
float lo = sim808.GPSdata.lon;
float w = sim808.GPSdata.speed_kph;
dtostrf(la, 6, 2,latitude ); //put float value of la into char array of lat. 6 = number of digits before decimal sign. 2 = number of digits after the decimal sign.
dtostrf(lo, 6, 2,longitude );
dtostrf(w, 6, 2,ws);
//************* Turn off the GPS power ************
sim808.detachGPS();
Serial.println("mesaage is");
sprintf(MESSAGE, "Latitude : %s\nLongitude : %s\nWind Speed : %s kph\nMy Module Is Working.Try With This Link.\n", latitude, longitude, ws);
sprintf(MESSAGE2,"http://www.latlong.net/c/?lat=%s&long=%s",latitude,longitude);
Serial.println(MESSAGE2);
// sim808.sendSMS(PHONE_NUMBER,MESSAGE);
dtostrf is a bit confusing, the 2nd argument is the minimum length of the output string, and will be padded with spaces when necessary. There is no specification for maximum length, other than the sum of the maximum number of digits, sign, decimal point, and leading zero if needed.