Lonkero,
First, *please* stop calling me Howard. It gets awfully confusing and I don't think Howard should take the blame for my views and mistakes
To pick up on a couple of your points:
quote:
kix, as it's script-language, can determine pretty much what strings contain
Don't forget that KiXtart is an interpreted language. There is a program which is reading the code and translating it. That program is written in...?
Ultimately the way strings are handled is determined by the interpreter. Strings are almost always handled as zero terminated arrays of characters. As in other languages, if you want to handle binary/raw data you don't use strings to do it, you use a binary storage object.
quote:
and if you try to add to the end of string manually the null character what happens?
cause that's allowed in c...
No it's not allowed in C.
If you treat the object as a string you cannot add '\0', because that's the end of the string - it's completely redundant.
Try this:
code:
printf("String length is %d\n",strlen("\0\0\0\0\0"));
The answer is of course zero.
You *can* access the memory where the string is stored and add whatever data you like to the end of it, but that is because you are no longer treating it as a string, you are accessing the memory as a raw object. Whenever you subsequently access it as a string the extra data past the first '\0' will be ignored.
Strings in C are not real storage objects, there is no "string" type in C. They are an abstract of character arrays, and that abstract expects them to be "any number of characters except '\0'"
This is true of KiXtart as well of course, except they are further abstracted by the interpreter, which has no provision to access the underlying storage object.
I know I've gone on a bit, but I think that it is useful to explain how the underlying storage mechanisms work, as it makes it easier to understand why some things work (or don't work) the way that they do.