View Full Version : how do i represent null values in ASCII
james bluetouch
05-19-2004, 09:30 AM
I can represent the following characters in ASCII
\b Backspace character (ASCII 8)
\f Form-feed character (ASCII 12)
\n Line-feed character (ASCII 10)
how do i represent a null (i can't just leave it out)?
I'm trying to control a projector (hardware) from the com port.
I have solved most of the problem but need to send null values as part of the trigger.
Thanks in advance
James
stealthelephant
05-19-2004, 09:39 AM
0 == null in c++ so maybe ascii too?
james bluetouch
05-19-2004, 09:53 AM
thanks dude... doesn't seem to work tho... it sends out the null as individual HEX codes.
The closest i can to it was '\x00' as part of a the command string
\xBE\xEF\x02\x06\x00\x13\xCE\xAA\x30\x30\x30\x30\x 30
the problem with this is that when i send it out of the com port the string is cut off at the '\x00', leaving out the rest of the string.
If i just don't include the null the string is wrong as it has to be that length. Also if i substitute the null for another value the string is also wrong.
doh...
ericlin
05-19-2004, 11:14 AM
I tried various methods. It is interpretated either as null terminating char or "";
If we have 00 in text file that we loads in, it is treated as null terminating character. The effect is truncating the string.
"\x00" or unescape("%65%00%65") does the same thing - truncating.
While chr(0), String.fromCharCode(0), "\u0000" are interpretated as "";
So, there is no "null" character.
:)
Long ago, I tried to manipulate "binary" data through Flash. I would have been able to load executable binary into Flash and modify it freely if Flash accepted 00 character.
james bluetouch
05-19-2004, 11:26 AM
thanks dude... looks like this is gonna be a mother of a problem to solve.. :cool:
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.