C++
unsigned char lbytes[] = { 0x0A, 0x01, 0x02 };
unsigned char bytes[10];
double dbl = sin((double)i) * 10;
i+=5; if (i == 360) i = 0;
memcpy(&bytes, &lbytes, 3);
cout << dbl << endl;
memcpy(&bytes[3], &dbl, sizeof(double));
C#
switch (m[1]) {
case 0x01: {
if (m.Length > 5) {
double myval = Math.Round( BitConverter.ToDouble(m, 3), 2 );
but something is going wrong here, myval is alsways some very small value and with rount it's always 0.
question is: where is my mistake, I can see valid value in cout, I send 10 bytes, what is going wrong?