Rewrite part of the example code from Adafruit FONA Recently, I bought the FONA 800 shield from Adafruit. I have got it running with the examples and it plays very nicely. 

I want to use the part of the example code which handles a call in my own sketch. The example code waits for a number to call which should be entered in the serial. I want to do the exact same thing, just with the phone number supplied from a variable in Arduino. 

I have two possibilities: To supply the whole number when the call should be performed and to build up let's say an array every time a number is entered. 

The code for performing a call: 

// call a phone!
    char number[30];
    flushSerial();
    Serial.print(F("Call #"));
    readline(number, 30);
    Serial.println();
    Serial.print(F("Calling ")); Serial.println(number);
    if (!fona.callPhone(number)) {
      Serial.println(F("Failed"));
    } else {
      Serial.println(F("Sent!"));
    }


The flushSerial function: 

void flushSerial() {
  while (Serial.available())
  Serial.read();
}


And the readline function:

uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout) {
uint16_t buffidx = 0;
boolean timeoutvalid = true;
if (timeout == 0) timeoutvalid = false;

while (true) {
  if (buffidx &gt; maxbuff) {
    //Serial.println(F("SPACE"));
    break;
  }

while (Serial.available()) {
  char c =  Serial.read();

  //Serial.print(c, HEX); Serial.print("#"); Serial.println(c);

  if (c == '\r') continue;
  if (c == 0xA) {
    if (buffidx == 0)   // the first 0x0A is ignored
      continue;

    timeout = 0;         // the second 0x0A is the end of the line
    timeoutvalid = true;
    break;
  }
  buff[buffidx] = c;
  buffidx++;
}

if (timeoutvalid &amp;&amp; timeout == 0) {
  //Serial.println(F("TIMEOUT"));
  break;
}
  delay(1);
}
  buff[buffidx] = 0;  // null term
  return buffidx;
}


It is the readline function which should be edited. Right now it retrieves the number entered from serial.

I am kind of a newbie myself so I am not that familiar with data types and so on. 

Thank you very much for any answers.

EDIT: 
The function without readline: 

if (!fona.callPhone("12345678")) {
        Serial.println(F("Failed calling"));
      } else {
        Serial.println(F("Calling ..."));
      }
I had to enter the numbers as a string. Also I found out that I had set the variables in a wrong way.

The library for the FONA Shield needs the number to call as a string. They are creating it by assigning the input from serial to a char. 
The problem was that I tried to input numbers. Also, I found out that when I tried to work with variables instead of hard coded numbers I messed around in data types.

Final conclusion: 
When calling the fona.callPhone function, you have to put in a string containing the numbers instead of actual numbers.