Arduino String problem Hello I am using the u8glib library to draw text on the string but it keeps giving me an error with the string

 String name1 = "";
 ...
 void draw(){
  u8g.setFont(u8g_font_micro);
  u8g.drawStr(22, 37, name1);
 }


why dosnt this work?

Here is the error:


  C:\Program Files (x86)\Arduino\libraries\U8glib/U8glib.h:200:16: note:
  no known conversion for argument 3 from 'int' to 'const
  __FlashStringHelper*' no matching function for call to 'U8GLIB_PCD8544::drawStr(int, int, String&amp;)'
String is evil and should be avoided at all costs (http://hacking.majenko.co.uk/the-evils-of-arduino-strings)

The author of u8glib knows that and has refused (quite rightly) to implement them.

You should not use String either.  If you really must for some obscure reason then you will have to pass the internal "C string" reference to the drawStr function instead of the whole String object:

u8g.drawStr(22, 37, name1.c_str());


The only reason people use String is because they are too lazy to learn the proper way of handling textual data in C.