*Mem=AllocateMemory(500)
String.s=""
For i=1 To 6
String.s+"7"
Next i
;/ No preceding null is written
PokeS(*Mem+16,Chr(0)+String.s,Len(String.s)+1)
;/ Chr(6) is correctly written
;PokeS(*Mem+16,Chr(6)+String.s,Len(String.s)+1)
Debug PeekS(*Mem+16)
Debug PeekC(*Mem+16)
Mistrel wrote:I'm writing a preceding null in front of the string I'm poking. Shouldn't I get a blank string? The character doesn't seem to be written at all.
A null, or Chr(0), isn't a string it's a terminator. It shows the end of a string. That being said, I agree that it should function as you expected.
string.s = "777777"
;/ No preceding null is written
PokeS(*Mem+16,Chr(0)+string.s,Len(string.s)+1)
Debug PeekS(*Mem+16)
Debug PeekC(*Mem+16)
;/It works as you would expect with a string constant
PokeS(*Mem+16,Chr(0)+"333",Len("333")+1)
Debug PeekS(*Mem+16)
Debug PeekC(*Mem+16)
Mistrel wrote:I'm writing a preceding null in front of the string I'm poking. Shouldn't I get a blank string? The character doesn't seem to be written at all.
A null, or Chr(0), isn't a string it's a terminator. It shows the end of a string. That being said, I agree that it should function as you expected.
string.s = "777777"
;/ No preceding null is written
PokeS(*Mem+16,Chr(0)+string.s,Len(string.s)+1)
Debug PeekS(*Mem+16)
Debug PeekC(*Mem+16)
;/It works as you would expect with a string constant
PokeS(*Mem+16,Chr(0)+"333",Len("333")+1)
Debug PeekS(*Mem+16)
Debug PeekC(*Mem+16)
It looks like it may be a bug.
If first code are compiled in ASCII the NULL char isn't write? On Unicode mode all char less than 255 use a Char(0) before the number, like 00FF for Chr(255), you tried use double null chars in unicode programs?
Sorry by bad English.
HP Pavilion DV6-2155DX: Intel i3-330m 2.13 / 4GB DDR3 / 500GB Sata2 HD / Display 15.6" LED / Win7 Ultimate x64 / PB 4.50 x86 demo.