Clearing a String to for the next data.

First of all Im sorry, im quit new to this.

*This code is a part of much larger code which tracks you via GPS and sends the coordinates via GSM

I cant tell what is wrong with this line of codes to clear the whole string and to enable clearer readings, In return data doesn't refresh and give the current location it just sends the initial coordinates when I turned it on.

String sendData (String command , const int timeout ,boolean debug)
{
  String response = "";
  sim808.println(command);
  long int time = millis();
  int i = 0;

  while ( (time+timeout ) > millis())
  {
    while (sim808.available())
    {
      char c = sim808.read();
      response +=c;
    }
  }
  if (debug) 
  {
     Serial.print(response);
  }
     return response;
}

*This code is a part of much larger code which tracks you via GPS and sends the coordinates via GSM

I don't want to be tracked...


don't use the String class...

  long int time = millis();millis() is an unsigned long

  while ( (time+timeout ) > millis())To handle rollover correctly, this needs to be written as

  while ( millis() - time <= timeout) {...

but worse...

In return data doesn't refresh and give the current location it just sends the initial coordinates when I turned it on.

we don't have the whole code, you could have bugs elsewhere
we don't know if your GPS works nor how it's wired
we have no clue what command you send to your sim808

a bit in the dark to help out...

Avoid using Strings, as they cause memory problems and program crashes on Arduino.