VikramBhat:
Is there some better way to send the bytes then? with starting markers?
I think it is best to send ascii characters with markers. Much easier to troubleshoot, and no endianess problems.
VikramBhat:
Is there some better way to send the bytes then? with starting markers?
I think it is best to send ascii characters with markers. Much easier to troubleshoot, and no endianess problems.
KeithRB:
I think it is best to send ascii characters with markers. Much easier to troubleshoot, and no endianess problems.
+1
But I said that in Reply #10 and it was ignored.
...R
We seem to be in the minority nowadays.
Robin2:
Silly me to take notice of the Thread title.
Not silly to take notice
But it is a bit silly to answer without reading the rest of the topic
That's why I usually skip topics which have more then 5 replies already.
I would say "best" is a big word. But it's indeed certainly easier to debug when sending ASCII, especially between languages and devices.
septillion:
Not silly to take noticeBut it is a bit silly to answer without reading the rest of the topic
That's why I usually skip topics which have more then 5 replies already.
I would say "best" is a big word. But it's indeed certainly easier to debug when sending ASCII, especially between languages and devices.
but "I think it best" makes it smaller. 8^)
Hehe, you're right
I merely meant to say it depends what has priority to say which is the best solution. Sending raw data is nice and small and needs little processing on both ends but sending ASCII has the advantage of being readable, easy to sync with delimiter and no mess with int-size and endianess.
septillion:
Hehe, you're rightI merely meant to say it depends what has priority to say which is the best solution. Sending raw data is nice and small and needs little processing on both ends but sending ASCII has the advantage of being readable, easy to sync with delimiter and no mess with int-size and endianess.
I think that ASCII is a more beginner friendly format, especially when there are multiple platforms involved. It is the "diplomatic language" of computing.
christop:
This line is surely wrong:byte *p = (byte)myInts;A pointer's value can be bigger than 8 bits wide, but you're losing everything but the lowest 8 bits by casting myInts to a byte.
But,
p[i]
is indeed a byte. That part of the code is correct.
He is saying that p is a pointer to byte. When a pointer is initialized, you are putting an address in there, not a value, so casting myInts to a byte - even assuming it is a pointer - will store an 8 bit value into a pointer.
Note that is the difference between:
byte *p = (byte)MyInt;
// vs
byte *p = &some_other_byte;
*p = (byte)MyInt;
cf Harbison and Steele, 4.6.3
Don't know where that went wrong (and I surely missed it) but I did
byte *p = (byte*)myFloats;
and also works for int's.
And I agree it being a bit more beginner friendly ![]()