Go Down

Topic: PIs it possible to use a String as a return value? (Read 509 times) previous topic - next topic

teddyz

Now I have learned something. There is a reason they made String! :-)

Okay, my big problem was Ethernetshield-related. I tried another and it worked fine, but at that point had I already started migrating from String.

I need help with this:

I converted my SWE-function (see above) to live without String. Now it looks like this, and relies on a replace-function found with Google.
Code: [Select]
void SWE( char * in ) { // Translate characters to the web client
  replace(in, "å", "å");
  replace(in, "ä", "ä");
  replace(in, "ö", "&oring;");
  replace(in, "Å", "Å");
  replace(in, "Ä", "Ä");
  replace(in, "Ö", "&Oring;");
  replace(in, "º", "°");
  replace(in, "°", "°");
}


Using it, I can convert char arrays. Great if they are variables.
But I can't convert this:
Code: [Select]
client.println("</br>");

To get around this problem I tried to put client.println() into the SWE-function, but it did not work.
Then I tried to use a pointer to it, but I can not make it compile "C.println(in);". I get the error "request for member 'println' in 'C', which is of non-class type 'EthernetClient*' ":

Code: [Select]
..
//Where I send html to the client
SWE("</br>", recTemp);
..


void SWE( char * in, EthernetClient * C ) { // Translate characters to the web client
  replace(in, "å", "&aring;");
  replace(in, "ä", "&auml;");
  replace(in, "ö", "&oring;");
  replace(in, "Å", "&Aring;");
  replace(in, "Ä", "&Auml;");
  replace(in, "Ö", "&Oring;");
  replace(in, "º", "&deg;");
  replace(in, "°", "&deg;");
  C.println(in);
}


Any ideas? Later, I would like to move the HTML to an SD card. That must have been done before? Perhaps with some functionality to put in variable values?

Go Up