I am working on reading a text file from the server, using http://arduino.cc/en/Reference/GSMClientConnected. It gives me this code:

char path[]="/asciilogo.txt"

I want to store only the contents that are inside the text file to a variable (String). But client.read(); only reads a single character at a time. Also, it takes all the HTTP, GET, TIME parameters together.

How to store only the contents that are present in the text file to a string variable?

1 Answer 1


Here is what I found:

You need to have a special character like "*" (a delimiter), from which important data will flow through.

char z = '*';
int s=0;

void setup()
  // usual initialization  

void loop()
  if (client.available())  
    char c = client.read();
    // Serial.print(c);
    if (z == c)

  if(s == 1)
    int i=0;
    k[i] = c;
    // Serial.print(k);

  place +=k;



  • 1
    that'll work but you have to declare i outside of the loop() because the way it is now, it'll always be 0.
    – sachleen
    May 7, 2014 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.