SEND_STRING 0 acts like a NULL terminated C string
Joe Hebert
Posts: 2,159
The Notifications and Diagnostics windows do a good job of substituting each non printable byte with a $ sign followed by its 2 digit hex value - except when a NULL is reached in a SEND_STRING 0. The SEND_STRING 0 gets terminated as soon as it reaches a NULL as if it were a C string.
For example:
SEND_STRING 0, "'12',1,2,255,$48,'ello',0,' there'"
Prints this in the Diag window:
Line 1 :: 12$01$02$FFHello - 05:16:33
When it should have printed this:
12$01$02$FFHello$00 there
Can this get fixed in a future rev of Netlinx Studio?
Thanks.
For example:
SEND_STRING 0, "'12',1,2,255,$48,'ello',0,' there'"
Prints this in the Diag window:
Line 1 :: 12$01$02$FFHello - 05:16:33
When it should have printed this:
12$01$02$FFHello$00 there
Can this get fixed in a future rev of Netlinx Studio?
Thanks.
0
Comments
I.E., if you have a device that you're sending strings to, and some of those strings contain $00, you're not going to see anything following the preceeding byte in either NetLinx Diagnostics while monitoring strings going out to devices, OR if you do a S_S 0 with that same string for debugging purposes.
So, unfortunately it's not something that CAN be avoided - Studio/Diagnostics should deal with it properly by some means, just like it deals with other non-printable codes. Hey - if those strings can be sent out to our devices without getting prematurely terminated by a $00, they should be able to get to a freakin' debug window just as easilly.
- Chip
For example:
The SEND_STRING dv232 in the Notifications window prints out correctly:
Line 1 :: String To [5001:1:10]-[12$01$02$FFHello$00 there] - 14:01:40
The SEND_STRING 0 in the Diagnostics window does not:
Line 1 :: 12$01$02$FFHello - 14:01:40
I agree 100%. I don?t care what language or platform Netlinx Studio is written in. We shouldn?t have to avoid sending NULLs with SEND_STRING 0. Neltinx Studio should be fixed.
- Chip