how store variable on EEPROM

I am trying to store mobile number on EEPROM. Below sketch is reading mobile number from SIM card and out put is like " Mobile # is : XXXXXXXXXXXX "

I want to run this sketch in setup and store “messageFromPC” on EEPROM. or at least run in setup and keep as a global variable.

I try to use boolean to run once in loop but did not work.

#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8);//Configuring the serial pins by software
// Variable to store text message


const byte numChars = 32;
char receivedChars[numChars];
char tempChars[numChars];        // temporary array for use when parsing

// variables to hold the parsed data
char messageFromPC[numChars] = {0};

boolean newData = false;

//============

void setup() {
  Serial.begin(9600);
  SIM900.begin(9600);

  //  pinMode(led, OUTPUT);
  SIM900.print("AT+CMGF=1\r");//AT command to configure the SIM900 in text mode
  delay(200);
  SIM900.print("AT+CNMI=2,2,0,0,0\r");//configure the module to show the SMS through the serial port.
  delay(200);
  SIM900.println("AT+CPBS=\"SM\"");
  delay(200);
  SIM900.println("AT+CPBF=\"Aarduino\"");
  delay(200);
  Serial.println("This demo Start");
  delay(5000);
}

void loop()
{
  recvWithStartEndMarkers();
  if (newData == true) {
    strcpy(tempChars, receivedChars);
    parseData();
    showParsedData();
    newData = false;
  }
  SIM900.println("AT+CPBF=\"Aarduino\"");
  delay(1000);
}

//============

void recvWithStartEndMarkers() {
  static boolean recvInProgress = false;
  static byte ndx = 0;
  char startMarker = '#';
  char endMarker = '#';
  char rc;

  while (SIM900.available() > 0 && newData == false) {
    rc = SIM900.read();

    if (recvInProgress == true) {
      if (rc != endMarker) {
        receivedChars[ndx] = rc;
        ndx++;
        if (ndx >= numChars) {
          ndx = numChars - 1;
        }
      }
      else {
        receivedChars[ndx] = '\0'; // terminate the string
        recvInProgress = false;
        ndx = 0;
        newData = true;
      }
    }

    else if (rc == startMarker) {
      recvInProgress = true;
    }
  }
}

//============

void parseData() {      // split the data into its parts
  char * strtokIndx; // this is used by strtok() as an index
  strtokIndx = strtok(tempChars, "#");     // get the first part - the string
  strcpy(messageFromPC, strtokIndx); // copy it to messageFromPC
}

//============

void showParsedData() {
  Serial.print("Mobile # is : ");
  Serial.println(messageFromPC);
}

At the very least you're going to have to #include the EEPROM library.

Why do you even want to store it to EEPROM?
You need to keep this data over a power cycle?

wvmarle:
Why do you even want to store it to EEPROM?
You need to keep this data over a power cycle?

My main sketch is for auto engine control system which will look the oil level and engine temperature.
Some variable I want to change with conditions like tank high and deviation from ultrasound sensor to indicate the level. And mobile number etc...

one solution was configuration menu system which is difficult for me to arrange at all.
2nd option: send the SMS with specific format and parse data to define variable.

last is:

Minimum target is to read the contact detail from SIM and store as a variable that can be use in sketch.

furthermore I want to save the number in case of SIM change it will keep.

Mainly issue is I don't have idea how to handle String as variable.

dougp:
At the very least you're going to have to #include the EEPROM library.

Yes But I don't know how to declare String / Char data to Variable. Or at least get the number once on startup. I try

if (running){ /get number; !running;}

but it run again and again.

If you use string (null terminated char array) instead of the String class it should be pretty easy to store this data in EEPROM using EEPROM.put() and EEPROM.get().