Help replacing phone number with variable

Hello i am currently using an sd card with the sim900 gsm to send a message to a mobile device in case my potentiometer goes above a certain number,the telephone number that i'm using is the same one that comes from the SD card,and i would like a way to be able to replace the full number with just the word telephone since i already made a variable called telephone with the number integrated into it,here is the code

#define potPin A0
char tab[80];
#include <SPI.h>
#include <SD.h>
String adresse;
String telephone;
String poub1;
String poub2;
String poub3;
#include <SoftwareSerial.h>
SoftwareSerial gsm(7, 8);
const int chipSelect = 4;
char carac=0;

void setup() {
  pinMode(potPin, INPUT);
  int i=0;
  Serial.begin(9600);
  while (!Serial) {; 
 }

  Serial.print("Initialization SD card...");


  if (!SD.begin(chipSelect)) {
    Serial.println("échec de carte sd");

    return;
  }
  Serial.println("card initialize.");


  File dataFile = SD.open("config.txt");
   if (Serial.read());

  if (dataFile) {
    while (dataFile.available()) {

      tab[i]=dataFile.read();
      Serial.write(tab[i]);
      i++;
      delay(10);
    }
    tab[i]='\0';
    Serial.println();
        dataFile.close();        
 delay(100);
gsm.print("AT+CMGF=1\r"); 
 delay(100);        
String neww = tab;
int deb = neww.indexOf('=');
int fin = neww.indexOf(';', deb+1);
adresse=neww.substring(deb + 1,fin);   
Serial.println(adresse);
deb = neww.indexOf('=',fin+1);
  fin = neww.indexOf(';', deb+1);
telephone=neww.substring(deb+ 1,fin);  
Serial.println(telephone);
deb = neww.indexOf('=',fin+1);
  fin = neww.indexOf(';', deb+1);
poub1=neww.substring(deb + 1,fin); 
Serial.println(poub1);
deb = neww.indexOf('=',fin+1);
  fin = neww.indexOf(';', deb+1);
poub2=neww.substring(deb + 1,fin); 
Serial.println(poub2);
deb = neww.indexOf('=',fin+1);
  fin = neww.indexOf(';', deb+1);
poub3=neww.substring(deb + 1,fin); 
Serial.println(poub3);
  }  
  else {
    Serial.println("erreur ouvrir config.txt");
  }
}
void loop() {  
  int val = analogRead(potPin);
Serial.println(val);
delay(500);
 if(val>500)
{ Serial.println("help");
  gsm.begin(19200);
  delay(2000);
  gsm.println("AT + CMGS = \"+33750499330\"");
  delay(100);
  gsm.println("help");
  delay(100);
  gsm.println((char)26) ;
  delay(100);
  gsm.println();}

}

gsm.println("AT + CMGS = "+xxxxxxxxxxx""); is what i am trying to replace with telephone istead of the number

scimichi:
gsm.println("AT + CMGS = "+xxxxxxxxxxx""); is what i am trying to replace with telephone istead of the number

could you not use sprintf for that?

char fone_num[] = "+xxxxxxxxxxx";
char at_cmgs[25];

sprintf(at_cmgs,"AT + CMGS = \"%s\"",fone_num);
gsm.println(at_cmgs);

i tried the code u gave me however it said initaliwer failed to determine size so i replaced char*[]fone_num = with char* fone_num = however after testing the code it is still not working i put the variable telephone instead of the xxxx and also tried the full phone number and it still did not work

why don't you use a Serial.print to display the command string to the gsm.println

presumably you did

char* fone_num = "+33750499330";

and

sprintf(at_cmgs,"AT + CMGS = \"%s\"",fone_num);
gsm.println(at_cmgs);

Simple string concatenating should work:

// old codeline was:  
//gsm.println("AT + CMGS = \"+33750499330\"");

String atCommand  = String("AT + CMGS = \" + telephone + "\"");
gsm.println(atCommand);

// telephone includes the plus sign: "+33750499330"

did you forget a doubel quote before the first "+"

String atCommand  = String("AT + CMGS = \" + telephone + "\"");

sherzaad:
could you not use sprintf for that?

char fone_num[] = "+xxxxxxxxxxx";

char at_cmgs[25];  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

sprintf(at_cmgs,"AT + CMGS = "%s"",fone_num);
gsm.println(at_cmgs);

Horrible horrible bug you've introduced there. 25 characters is not enough for the sprintf result... Memory
corruption... That's not going to help anyone.

hannut:
Simple string concatenating should work:

// old codeline was:  

//gsm.println("AT + CMGS = "+33750499330"");

String atCommand  = String("AT + CMGS = " + telephone + """);
gsm.println(atCommand);

// telephone includes the plus sign: "+33750499330"

this actually worked perfectly thanks alot