String.concat();


try ....

as far can tell, 'localstring' ends llll..... expected 200 bytes long, whereas 'globalstring' ends gggg.... maybe 50 bytes long, rest lost in space. "concat" working within local function?

ideas?

quote

#include <newsoftserial.h>
newsoftserial lcd(2, 3);

string globalstring = "";
char inbyte;

void setup() {
  lcd.begin(115200);
  concattest();
}

void loop(){
  //
}

void concattest(){
  string localstring;
  for (int y = 0;y<200;y++){
    inbyte = 'l';
    localstring.concat(inbyte);
  }
  lcd.print(localstring);

  globalstring = "";
  for (int y = 0;y<200;y++){
    inbyte = 'g';
    globalstring.concat(inbyte);
  }
  lcd.print(globalstring);
}








concat should work on every string. sofar see no problem in code. how know amount of l's , g's?  what connected serial port @ 2/3 ? serial lcd's know of have no 200 positions.

a better way concat different chars string can check output easier. first add 10 a's 10 b's etc.
or 1234567891123456789212345678931234567894 etc (note iso 0's use 1 2 3 etc count 10's  )


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > String.concat();


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums