Insert Variables In AT commandes I'am trying to apply USSD operation with variable codes, for example this piece of code return my account balance:

             gsm.SimpleWriteln("AT+CUSD=1,\"*100#\""); 


i want to change "*100#" to variable so gsm.SimpleWrite uses what the variable contains. I want to find how to make it work like this:

             gsm.SimpleWriteln("AT+CUSD=1,\"Variable\"");


EDIT: here is my code to give you a better view. it return balance in serial monitor.          

#include "SIM900.h"



  void setup() 
    {
   Serial.begin(9600);
    Serial.println("GSM Shield testing.");
       if (gsm.begin(9600))
            Serial.println("\nstatus=READY");
      else Serial.println("\nstatus=IDLE");

         gsm.SimpleWriteln("AT+CUSD=1,\"*100#\"");
      delay(10000);
             char msg[200];
             gsm.read(msg, 200);
            Serial.print("resp: ");
            Serial.println(msg);
 }
    void loop()
     {

    }
I cannot find which "SIM900.h" library you are using - none of the ones I found have "SimpleWriteln" in them, so this is pure assumption about what functions and overloads may be available.

Just split your string into chunks, like you would with any serial device:

gsm.SimpleWrite("AT+CUSD=1,\"");
gsm.SimpleWrite(command);
gsm.SimpleWriteln("\"");


Where command is a suitable container for your data - say const char *.