Problem Parsing String to Sim800l.sendSms(celular),(message)

Hello ARDUINO Team .
Wishing all the best To all Of you .
Please forgive my english i am still learning .

escenario explanation to go straight to reach the topic point :

1)Variable String MESSAGE ,is an array build from a fixed header received by wifi webserver
2)variable String CELULAR gets the number to send sms to: , from String celular = (server.arg(2));

Very good i have 2 string variables CELULAR & MESSAGE .

  1. the function Sim800l.sendSms('+1xxxxxxxx'),('hello world '); WORKS FINE HAND WRITING THE VALUES

  2. what i need to solve on this topic is to be able to REPLACE THE VALUES HANDWRITTEN WITH THE VARIABLES
    on the function Sim800l.sendSms(celular),(message); (without the errors no matching function for call to 'Sim800l::sendSms(String, String)')

Example of Data on the array build On String MESSAGE variable:
name=jhon smith always fixed (server.arg(2));
description = hi please help me out solve this topic so i can go ahead with my project

On next resume parts of the code , i have Comment sending message using AT commands using the variables CELULAR & MESSAGE that works GREAT , but i will prefer to use instead , the Sim800l.sendSms(celular),(message); so i can reduce the code size, processing time and use of resources on my ESP8266 .

Libraries   included  <Sim800l.h> <ESP8266WiFi.h><WiFiClient.h><ESP8266WebServer.h><ESP8266mDNS.h><SoftwareSerial.h>

bool error; //to catch the response of sendSms

    String message = "Sending SMS \n\n";
      ///// reads the header received from webserver//////

    for (uint8_t i = 0; i < server.args(); i++) {              
  ///// build a string array with all variables received from header /////
 message += " " + server.argName(i) + ": " + server.arg(i) + "\n";  
  server.send(200, "text/plain", message);  ///// sends all content of MESSAGE array to client in response//////

  String celular = (server.arg(2));   ///// stores the 2nd argument of the array (that will always be fixed celular number to be send the sms /////


                     /*        /////// // SENDS  AT COMMANDS TO sim800l  //////////////////////////
                                ///Serial.println("Sending " + celular);
                                 //Set SMS format to ASCII

error = Sim800l.sendSms(celular),(message);    ///compile error no matching function for call to Sim800l::sendSms(String&)'
error = Sim800l.sendSms((server.arg(2)),(message);  /// compile error no matching function for call to 'Sim800l::sendSms(String, String)'
  ///// error = Sim800l.sendSms('+1xxxxxxxx'),('i need this to be a variable ');   With handwriting  it works great sending the sms 
  Serial.println("SMS Sent!to");
  void loop(void) {

If someone has the correct solutions for converting the variables in to a manner that i can place them inside the function Sim800l.sendSms(celular),(message); Please Just show me the conversion code needed to reach the goal , and i will logically understand the why .

I read 20 tutorials a day , and spend 12 hours reading daily , so please don't punish me sending me to read , cause i already read more than i can handle.

Thanks in advance for any help .

without the errors no matching function for call to 'Sim800l::sendSms(String, String)')

Well again you need to understand what you have (like to IPAddress object in our last discussion)

Here you are dealing with String object with a capital S (see String() - Arduino Reference) whereas you want just a char array standard c string in your function (see

So you need to extract from your capital S string the C string standard représentation, which you get by calling the method c_str() on your String object (see c_str() - Arduino Reference

message is String with capital S and so you need to pass message.c_str() to the function call



Is not a valid way to call a function with 2 parameters. Look at your parenthesis...should be function(param1, param2);

Makes sense?

If I may, You should read about object oriented programming - what are classes, instances, methods etc...

Hello JML ,Many thanks again for your cooperation .
I have read all you suggested ,
on the case of .c_STR does not saids much , just that the syntax is string.c_str() and it converts a string to
I also read String AND string

At the end of my reading and searching for examples codes where .c_strcould be apply and my conclusions i am at the same point.
where i don't imagine how to apply it to my case . so i did try all of theses with not succes at all .

char * allmessage=(message.c_str());
char allmessage=message.c_str();
char* allmessage[250]=celular.c_str();
string allmessage=message.c_str();

error = Sim800l.sendSms(celular1,allmessage);

-----------------------------ALSO-------------------------------- tried
error = Sim800l.sendSms(celular.c_str();,message.c_str());

All of them showing me eros at compile checking .

as you said
message is String with capital S and so you need to pass message.c_str() to the function call

i imagine the function call is .
error = Sim800l.sendSms(celular.c_str();,message.c_str());

well , i feel some embarrassed , but every day i am learning more and more .

JML where to apply the c._str() convertion of the message String
should i use another variable as recepient for the connversion like

char* celular1[25]=celular.c_str();

or just use the conversion straight to :
error = Sim800l.sendSms(celular.c_str();,message.c_str());

Or could be simpler to change the main array Message not to be String but string or char ?
String message = "Servicio envio sms Denis Thornhill\n\n";
for (uint8_t i = 0; i < server.args(); i++) {
message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
server.send(404, "text/plain", message);

I think that when i read some information i dont understand many of what its being told . like ????
null-terminated string ????
The String class, part of the core as of version 0019 ?????

Also when i read this examples i can not figured out where it converts a String variable into a char ?
String stringOne = "Hello String"; // using a constant String
String stringOne = String('a'); // converting a constant char into a String
String stringTwo = String("This is a string"); // converting a constant string into a String object
String stringOne = String(stringTwo + " with more"); // concatenating two strings
String stringOne = String(13); // using a constant integer
String stringOne = String(analogRead(0), DEC); // using an int and a base
String stringOne = String(45, HEX); // using an int and a base (hexadecimal)
String stringOne = String(255, BIN); // using an int and a base (binary)
String stringOne = String(millis(), DEC); // using a long and a base
String stringOne = String(5.698, 3); // using a float and the decimal places

SO JML if you can give me a little PUSH AGAIN , cause is not that i want Someone to solve my code , its just that while i see the working part of code i really do Logically understand what and how is doing . as it was with the other topic that you helped me out IPADDRESS. and SPRINTF , then i really understood what was going on and i will be able to apply it on other circumstances.

Thanks Again .

Also when i read this examples i can not figured out where it converts a String variable into a char ?

Where what converts a String variable to a char? Nothing does. There is a world of difference between a char and a char array. A String wraps a char array, which is exposed by using the c_str() member.

When you do this

String message = "Sending SMS \n\n";

It's not the same thing as doing

const char message[] = "Sending SMS \n\n";

In the first case You create message as a String (not the capital S) object. If you use functions that don't know how to deal with such an object and expect a char * or an array of characters which would be the second representation, then this is what you get by doing message.c_str()