I am currently learning c ++ and i a beginner. Since not too strict to me: D
I programmed a winsocket udp client in c ++. This is now send bytes array (like 54-53-33-49-4E-49-54-31-00-65-00-00-88-06-3B-EC-E9-00-5A-6D-F3-12-C9-B6-6E-82-00-00-00-00-00-00-00-00
) to a remote udp server. And this is my problem. I build the array in C # like that
byte[] sendData= new byte[versionLen + initTypeLen + 4 + 4 + 8];
byte[] Initversion = { 0x06, 0x3b, 0xec, 0xe9 };
Array.Copy(Initversion, 0, sendData, 0, versionLen);
[...]
Now in C ++ I have very strong problems. First I understood correctly that I have to build this in chars []?
My try:
char init1[/*VersionLength + InitPackLength + TimestampLength + 4 + 8*/ 9];
char Initversion[] = { 0x06, 0x3b, 0xec, 0xe9 };
char StepNumber[] = { 0x00 };
init1[0] = 0x06;
init1[1] = 0x3b;
init1[2] = 0xec;
init1[3] = 0xe9;
init1[4] = 0x00;
init1[5] = 0x06;
init1[6] = 0x06;
init1[7] = 0x06;
init1[8] = 0x06;
But the result: 06-3B-EC-E9
C++ remove all bytes after the 0x00
. How can i fix that? What is the right solution?
Thank you.
EDIT: Thats my code: https://paste.ee/p/vfYf4