Skip to main content
1 of 3
Juraj
  • 18.2k
  • 4
  • 30
  • 49

If you set 0 as string terminator after last character in the buffer, you get a zero terminated string. If you really must use String, you can create an instance with a constructor that takes zero terminated string.

buffer[tam] = 0;
String str(buffer);

Note: Don't use String class in a MCU, use zero terminated character arrays.

Juraj
  • 18.2k
  • 4
  • 30
  • 49