Coding Help with String + Char (HEX) ...


hi everyone, i've been searching days , give simple. let me show example, easier explain way:

code: [select]
string msgkey = "";
msgkey += (char)0x00;
msgkey += (char)0x13;
msgkey += (char)0x00;
msgkey += "mcc.aapp.samsung";


that code gives me when serial printed:

   mcc.aapp.samsung

it's part of tcp connection tv. full message works fine way, building message way requires can see, lot of code lines. tried join in 1 line, nothing works.... way's tried:

string msgkey = string((char)0x00) + string((char)0x13) + string((char)0x00) + "mcc.aapp.samsung";

string msgkey = string(00, hex) + string(13, hex) + string(00, hex) +"mcc.aapp.samsung";

string msgkey = "\x00\x13\x00mcc.aapp.samsung";

string msgkey = (char)0x00 + (char)0x13 + (char)0x00 + "mcc.aapp.samsung";

can enlight me on how make code work in 1 line ?, if it's possible....

the serial monitor doesn't job of interpreting non-printable characters. code have works.

edit- until sketch gets large or runs long, , string class crashes program due heap fragmentation. :)


Arduino Forum > Using Arduino > Programming Questions > Coding Help with String + Char (HEX) ...


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts