In addition to barry's post above:
When using addresses of string literals, keep in mind that identical literals will be reused, so different pointer variables could point to the same string, affecting each other:
Code: Select all
EnableExplicit
Define s1.s = "test"
Define s2.s = "test"
s2 = "test2"
Debug s1 ; test
Debug s2 ; test2
Define *s3 = @"test"
Define *s4 = @"test"
PokeS(*s4, "x")
Debug PeekS(*s3) ; x
Debug PeekS(*s3) ; x
But I don't know why you would want to use pointers to string literals, especially poking at them will corrupt memory if the poked string is to long. There is no automatic reallocation like with normal string operations:
Code: Select all
*s = @"0123"
ShowMemoryViewer(*s, 100)
Delay(1000)
PokeS(*s, Space(38))
ShowMemoryViewer(*s, 100)