I am working with a wifi microcontroller that needs to serve up a large (20kb) static html page. Because individual buffers on the microcontroller only hold 1.4kb, it is necessary to break up the html into chunks and send the pieces one at a time.
What I have right now is about 100 string assignemnts that look like this:
char HTML_ID_96[] = "\
<p><a href=\"#t\">Return to top</a></p>\
<a id=\"id9\"/>\
<span class=\"s\">Firmware Version/Information</span>\
<span class=\"c i\" id=\"id9-h\" onclick=\"h(\'id9\');\">hide</span> \
<span class=\'c\' id=\"id9-s\" onclick=\"s(\'id9\');\">show</span>\
<table class=\"t i\" id=\"id9-table\"><tbody>\
";
I would like a way to impose an iterable sequence on all of the strings by sticking them in an array, but I am not sure how to package them.
I have tried:
char** all = [HTML_ID_1, ..., HTML_ID_99];
char* all[] = [HTML_ID_1, ..., HTML_ID_99];
char all[][] = [HTML_ID_1, ..., HTML_ID_99];
But none of them compile. Any references to how C handles arrays is a bonus.
Extension:
char const* HTML_ID_100 = "\
</form>\
</body>\
</html>\
";
char const* all[] = {HTML_ID_100};
Is not compiling. I'm using gcc 3.4.4. Two errors are reported: "initializer element is not constant" and "(near initialization for 'all[0]')". Both occurring on the last line shown.
Return to top
"` (new line) `""` (new line). And so on. No need for the icky backslash. – Lundin May 23 '13 at 15:35