When i send some like: "02 01 CF 06 09 29 02 58 B0", all works perfect, but if i try to send "02 01 CF 00 09 04", fails... the problem is the 00. The strtol function give a 0, and that in the char[] is like "\0"... so the function, cut the string at the "00".
And the hardware in the other side, expect de "00" as part of the data.
char* -- ie, C-style strings-- are by definition ASCIIZ (\0) terminated. Therefore, you cannot achieve what
you want to without also returning a hand-computed length (and thus strlen() will not work).
Alternatively, you could use a C++ string -- std::string -- which will handle embedded \0 just fine.