diceman wrote: Tue Jan 27, 2026 8:56 pmPlease, for really stupid people like me, can you explain in layman's terms what that actually means?Fred wrote: Fri Jan 23, 2026 10:47 amBasically if you patch a string by putting a zero in it, the Len() function will be wrong, and the concat functions will fail. You will need to use PeekS() for this.![]()
Code: Select all
a$ = "1234567890"
PokeU(@a$ + 5 * SizeOf(CHARACTER), 0) ;write an end of string after the "5" to shorten the string by "cheating"/patching
Debug Len(a$) ;PB <6.40 will show 5, ;PB 6.40 will still show 10, because it doesn't care about the end of string character
;solution for PB6.40 here would be:
;a$ = PeekS(@a$) ;just uncomment it and see the difference
;because PeekS() looks for the first zero byte/word and the strings size will be corrected
a$ + "67890" ;concat
Debug a$ ;PB <6.40 will show 1234567890, PB 6.40 will show 12345, because in PB 6.40 the string is now in memory "12345" + chr(0) + "7890" + "67890" (+ chr(0))
ShowMemoryViewer(@a$, 32)
Debug Len(a$) ;PB <6.40 shows 10, PB 6.40 shows 15
