View Full Version : Why no early termination of Zstring when zero is in text?
John Kauffman
11-13-2010, 12:07 AM
In the following ZStrings, why is the string not considered terminated after the fifth character (the internal zero)?
text.str(string("The 0 come first"))
DAT
myString byte " The 0 come first ",0
Phil Pilgrim (PhiPi)
11-13-2010, 12:09 AM
It's because it's an ASCII "0" which has the value $30, not $00.
-Phil
John Kauffman
11-13-2010, 12:53 AM
I'm half way understanding, just need to be sure....
myString byte "The 0 come first ",0
So in the above the zero at the end is being treated like a code (in the way of 13 for CR).
Therefore:
myString byte "The 0 come first 0"
has not been terminated.
Thanks.
Phil Pilgrim (PhiPi)
11-13-2010, 02:31 AM
That's correct.
-Phil