an array within an HTML GET command

I have an HTML line in a sketch:
client.println("GET /xml/current_obs/KVNY.xml HTTP/1.0");
I would like to put a array in for KVNY.

char* icao[]={"KVNY"};

setup() ...

loop() ...

client.println("GET /xml/current_obs/(icao[0].xml HTTP/1.0");

This addition compiles and uploads, but doesn't work.

You might need to do something like below to get your array into the string you want to send.

client.println("GET /xml/current_obs/" + (icao[0]) + ".xml HTTP/1.0";

Thanks, but that did not work. It just inserted the + (icao[0]) + to the output.
Got to think about some more.

Any particular reason why you want to use an array instead of a string?

You're using cstrings, not String objects - the easiest way to do what you want would be sprintf.

char icao[]="KVNY";
// ...

char buf[strlen(icao) + 40]; // About 45 characters of buffer space
sprintf(buf, "GET /xml/current_obs/%s.xml HTTP/1.0", icao);
client.println(buf);

If you use a String object, the + operator will concatenate strings for you.

zoomcat!

Great help. I don't think I've seen sprintf in Arduino examples, but it surely is in C.

Thanks

The information output for the GET command does not need to be output all at once.

client.print("GET /xml/current_obs/");
client.print(icao);
client.println(.xml HTTP/1.0");

will output the data in icao as part of the GET command, without the overhead of a buffer and the sprintf code.