Posted: Thu Nov 06, 2003 1:22 am
erm, wait.. 64K is the limit right? And your saying that will hold 64,000 characters? Which mean each Char is a Byte (represented from 0 to 255). So that includes all of the extended ascii?
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
Directory$ = Space(500)
GetWindowsDirectory_(@Directory$, 500)
Debug Directory$
Code: Select all
1. add a new type .c (a fixed length string):
var.c[n] declares a 'character' variable, length n bytes
2. interaction with normal :-) strings:
var.c[5] = "123"
- put "123" + NULL in the first four bytes of var.c
- it actually reserves 5 bytes, even though only 3 are used
var.c[5] = "1234567"
- put "12345" in the five bytes of var.c
var.c[2] = "1"
var.c[100] = "1"
- effectively, resize var.c
3. normal string commands
a.s = "1234abc"
var.c[10] = ucase(a.s)
- create a var.c of length 10, fill it with "1234ABD" + NULL
a.s = var.c
- convert var.c to a normal string (zero terminated) then assign it to a.s
4. in other words...
basically, use anything right of the '=' character that is a normal
string (zero terminated) string, and the whole expression will
be evaluated as if it was a zero terminated string, upto filling
of the actual fixed length string var.c
i'm not sure, but i guess this could be implemented, allows inclusion
of strings fields in structs for api calls (i HATE pooking, that's as
old as a vic20)
this also allows dirty memory reservations on the fly (instead of
malloc(), just say var.c[64000] = "") and it should not affect
speed in any significant way
Why not look at already existing open source code to see how they did itIf somebody has a brilliant idea for that, i'm open to suggestions.
... it's just that it isn't that easy to implement.
I believe on his words.I will add support for single and triple buffering methods.