
For MIDI programming, I would like to see strings that can contain ascii zero.
I strongly agree with this. Also, being able to pass this type of stringgeoff wrote:I'd like to see strings that can contain chr(0). This would greatly simplify the handling of binary files.
PB Strings are zero terminated, i.e. the length isn't stored anywhere. The boundary of 64k comes from the fact, that PB internally allocs 64k for String operation.newtheogott wrote:Currently Purebasic has 16-bit strings.
16 bit= 65536 maximum length.
All other Basic languages have 32 bit strings. Because 32 bit= 2 GB maximum length. Thats just for each string 16 bits more for the lenght part.
Code: Select all
Procedure SetStringManipulationBufferSize(Size)
PBStringBase.l = 0
PBMemoryBase.l = 0
!MOV eax, dword [PB_StringBase]
!MOV [esp+4],eax
!MOV eax, dword [PB_MemoryBase]
!MOV [esp+8],eax
HeapReAlloc_(PBMemoryBase, #GMEM_ZEROINIT, PBStringBase, Size)
!MOV dword [_PB_StringBase],eax
EndProcedure
; Set the buffer to 1 100 000 bytes...
;
SetStringManipulationBufferSize(1100000) ; 1,1 Mb for our strings...
; And prove it !
;
For k=0 To 10000
a$ + "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
Next
Debug Len(a$)
No and yes. No, they are not affected, but a good lib-function should allocate as much as it'll need.Karbon wrote:And does that affect the internal buffers of some of the string functions?