PDA

View Full Version : Embedded "zero" characters (characters where ascii(char) = 0)



Bernhard Mandl
21-Mar-2005, 03:20 PM
I just spent quite some time to find out that strings are truncated at
"zero" characters when a string is returned from an object's function to a
global function, but not when returned from one function of the object to
another (this was _not_easy to find)

Does anyone know when a string containing a "zero" character can safely be
used and when it will be truncated at the "zero" character.

Thanks
Bernhard

PS: I am especially interested in the behaviour under df 3.1 / 3.2

Sture Andersen
21-Mar-2005, 03:48 PM
Global strings aren't zero terminated, but they can be no longer than 80
characters. Unless you declare it like this:

string myglobalstring 255

255 is the maximum length of a global string (no matter the value of
MAX_ARGUMENT_SIZE).

-Sture

Curtis Krauskopf
21-Mar-2005, 06:01 PM
Bernhard,

"It works for me". Modify the attached program to make it fail the way
you're seeing and upload the modified program.

As Sture mentioned, global variables default to 80 chars.

Curtis Krauskopf
The Database Managers, Inc.

Bernhard Mandl
22-Mar-2005, 03:20 PM
Very interesting!

I fail to see where the difference between your program and mine is, but the
string is truncated at the null character in mine.

Run the attached "cryptest.flx to see my problem"

Regards,
Bernhard

"Curtis Krauskopf" <curtis@decompile.com> schrieb im Newsbeitrag
news:4NJTEomLFHA.1248@dacmail.dataaccess.com...
> Bernhard,
>
> "It works for me". Modify the attached program to make it fail the way
> you're seeing and upload the modified program.
>
> As Sture mentioned, global variables default to 80 chars.
>
> Curtis Krauskopf
> The Database Managers, Inc.
>
>
>