how to convert "char xx[]" to "String" ?

I make a project that need "char xx[266]" to convert to "String"

here the sample code

char response[266];
int i;
String tmp;
char kosong[1];
boolean b = false;
void setup() {

Serial.begin(9600);
}

void loop() {
if(b==false){
for (i = 0; i < 10; i++){

response*=i; *

  • }*
  • tmp = response;*
  • Serial.println("tmp = "+tmp);*
  • b=true;*
  • }*
    }[/quote]
    but it won't work, I also tried
    > tmp = response
    but still nothing happen
    I only got this from serial monitor

You make response=i ten times so when the loop is finished the response variable is equal to 9 and 9 is not a printable ASCII character.

  1. a string of 266 is damn long, why do you need that?
  2. You already have a string (char xx[]), why do you need the troublesome String? It's better left out.

It makes no sense to assign an integer to an array of char. Forget the "String" class - it is no good on arduino.

Grumpy_Mike:
You make response=i ten times so when the loop is finished the response variable is equal to 9 and 9 is not a printable ASCII character.

ah my bad, thanks for answering.

septillion:

  1. a string of 266 is damn long, why do you need that?
  2. You already have a string (char xx[]), why do you need the troublesome String? It's better left out.

I just follow a tutorial and it use that so I just write it :smiley:

I would very much like to see that tutorial.. What is your code supposed to do?