I want to create a string array a$(100000) and populate it with strings of
varying length. Most have just a few characters but several have many
thousands. Some of these strings contain chr(0).
This is easy in most Basics but PB does not allow chr(0) within strings.
Is there a simple alternative?
String arrays
I don't *think* there would be any way to include a NULL character within a string since NULL indicates end-of-string. I can suggest maybe escaping the NULLs (rather, replacing the NULLs with something) and re-assembling then when they're used?
Good luck!
Good luck!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Yes, that's probably the best way to do it.Maybe you can do an array of pointers instead and allocate memory for each entry in the array to hold the string data..
But, this is equivalent to writing your own pseudo-string routines. Sadly, the PB string functions would not work on these pseudo-strings so you would have to write versions of them as well.
Alternatively, you could manipulate the memory bytes directly using pointers. But the main advantage of using a high level language is to avoid this sort of thing because it is slow to write and error prone.
This leaves me thinking that PB strings should allow null characters. You could still have a null as the last character if you wanted to, for compatibility with C, for example
Fred, why not allow nulls in strings like other Basics?
Basic is clearly superior to C in this respect, so why do it the C way?
Can anyone see a problem with this idea?
Yea, backwards compatibility would probably be the single biggest problemThis leaves me thinking that PB strings should allow null characters. You could still have a null as the last character if you wanted to, for compatibility with C, for example
Fred, why not allow nulls in strings like other Basics?
Basic is clearly superior to C in this respect, so why do it the C way?
Can anyone see a problem with this idea?

Regardless, there has to be something to indicate end-of-string and NULL is pretty widely used an accepted as that character.. However toss this into the feature request forum and see what happens!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Moving away from zero terminated strings would, I imagine, cause Fred working a long time fixing something that's not broken. Try to call the API with a string like that. Is it possible to convince the API that zero is not the termination character? I don't know.
Sure, it could be neat being able to include a NULL character but what's the cost (rewriting the compiler) vs the benefit (sometimes useful)?
Then again, I have been known to be wrong from time to time...
Have a nice day all!
/Gantry
Sure, it could be neat being able to include a NULL character but what's the cost (rewriting the compiler) vs the benefit (sometimes useful)?
Then again, I have been known to be wrong from time to time...
Have a nice day all!
/Gantry
*** In the end we will remember not the words of our enemies, but the silence of our friends. (Martin Luther King Jr.) ***
hmmmm.....
well, i think it would be a cool idea to have strings that could contain nulls, but the best approach would probably be a new type of string, rather than changing how current strings work.
something like nullstring.ns perhaps? i know for certain that it would be very usefull to me.
well, i think it would be a cool idea to have strings that could contain nulls, but the best approach would probably be a new type of string, rather than changing how current strings work.
something like nullstring.ns perhaps? i know for certain that it would be very usefull to me.
--Aszid--
Making crazy people sane, starting tomorrow.
Making crazy people sane, starting tomorrow.