Reverse engineering characters to ascii


so i've got code (see below) turns characters ascii, works great want make turns ascii characters i'm completly lost. if tell me how modify code or me (i wont mind ;) ) great.

code: [select]
void setup()

{
  serial.begin(9600);

  char string[] = "abd";
  char buffer[4 * sizeof(string)];
  char* buffptr = buffer;

  (byte = 0; < sizeof(string) - 1; i++) {
    itoa((int)string[i], buffptr, 10);
    buffptr += strlen(buffptr);
    *buffptr = ' ';
    buffptr++;
  }
  buffptr--;
  *buffptr = '\0';
  serial.println(buffer);

}

void loop()

{

}

in code above use itoa() convert int ascii


you can use opposite function atoi() go other way



Arduino Forum > Using Arduino > Programming Questions > Reverse engineering characters to ascii


arduino

Comments

Popular posts from this blog

Error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode - Raspberry Pi Forums

class MPU6050 has no member named begin

missing filename after '-o'