Game Development Community

Question about the ascii character zero (\x00)

by Oswaldo C. Filho · in Torque Game Builder · 08/31/2006 (2:56 pm) · 4 replies

Is not possible to use \x00 character in TGB ?
example:

%text = "123456";
echo(strlen(%text)); // it's show 6

%text = "123456\x01";
echo(strlen(%text)); // it's show 7

%text = "123456\x00";
echo(strlen(%text)); // it's show 6 (the \x00 is excluded)

because ?

thanks

About the author

Currently producing the game HellEscape: http://www.baguettegames.com/


#1
08/31/2006 (3:13 pm)
You don't need it. All strings are stored internally as null char terminated within the workspace, and TorqueScript removes the need for you to worry about it.

Were you to actually be able to put a manual \x00 on the end, your strings would look like "123456\x00\x00" which would cause all sorts if issues most probably.
#2
08/31/2006 (3:30 pm)
Thanks for the fast reply,

But i need the \x00, i have this character as a part of a string.
Ex:

"012345\x00ABC\x00\xA8\xF6"


No haves other way to i use this char on the middle of a string ? i need all \x00 to \xFF

thanks
#3
08/31/2006 (3:52 pm)
You cannot do that with TorqueScript, and in fact cannot do that with standard C++ null terminated strings.

The x\00 by definition is the end of the string, and cannot be in the middle of the string.
#4
08/31/2006 (4:29 pm)
Hunn, thanks i will change my code :-)