printing multi line html to web page

Hi I am trying to multiline html text(style in head) to a web page

const char htmlStyleMultiline[] = "<style>"
                                  ".tooltip {"
                                  "    position: relative;"
                                  "    display: inline-block;"
                                  "   border-bottom: 1px dotted black;"
                                  "}"

                                  ".tooltip .tooltiptext {"
                                  "   visibility: hidden;"
                                  "   width: 120px;"
                                  "   background-color: black;"
                                  "   color: #fff;"
                                  "   text-align: center;"
                                  "    border-radius: 6px;"
                                  "    padding: 5px 0;"

                                  "    /* Position the tooltip */"
                                  "    position: absolute;"
                                  "    z-index: 1;"
                                  "}"

                                  ".tooltip:hover .tooltiptext {"
                                  "    visibility: visible;"
                                  "}"
                                  "</style>";


void printProgStr(PGM_P const str[])
{
  char c;
  if (!str) return;
  while ((c = pgm_read_byte(str++)))
    //    Serial.print(c, BYTE);
    Serial.write(c);
}

an in loop function I call the printProgStr (htmlStyleMultiline)

but I get the error saying

cannot convert 'const char*' to 'const char* const*' for argument '1' to 'void printProgStr(const char* const*)'

not sure what does that mean and how to fix it , please help.

So, you have a array with some type and some modifiers. You have a function that takes an array with some type and some modifiers.

You have an error message that says that the array types and modifiers are not consistent.

What you do not have is the call to the function.

You need to either change the function to use the same type as you supply, change the type of the variable passed to the function to match what it expects, or use a cast to lie to the function.

The simplest is, of course, to remove the extra const from the function definition.

"void printProgStr(PGM_P const str[])"
"void printProgStr(const char* const*)"

Looks like it is expecting an array of pointers, not an array of characters. It is also expecting PGM_P pointers: pointer into PROGMEM.

I would try changing the function to:

void printProgStr(PGM_P str)

and change the declaration of the string to:

const char htmlStyleMultiline[] PROGMEM = "<style>"...

cool, that works, however I am going to put that to a function so I can construct a string from values passed to the function as argument.

How would I concatenate a string or integer to string value to be concatenated and printed as html ?

How would I concatenate a string or integer to string value

strcat() to concatenate strings.

You can't concatenate integers to strings.

You could convert the int to a string (using itoa()).

For the string constants I'd use Serial.print(F("A string constant"));

For variables I'd use Serial.print();

There is no advantage to cramming all of the parts into one huge string and then printing the string.

johnwasser:
There is no advantage to cramming all of the parts into one huge string and then printing the string.

I want to keep the display html text into a separate module file than the main sketch.

seaurchin:
I want to keep the display html text into a separate module file than the main sketch.

So? It still doesn't have to be one huge string.

johnwasser:
"void printProgStr(PGM_P const str[])"
"void printProgStr(const char* const*)"

Looks like it is expecting an array of pointers, not an array of characters. It is also expecting PGM_P pointers: pointer into PROGMEM.

I would try changing the function to:

void printProgStr(PGM_P str)

and change the declaration of the string to:

const char htmlStyleMultiline[] PROGMEM = "<style>"...

Hello John,
I uploaded the compiled code today. i found the multiline html text is not getting embedded in between the tag