Hi.
I remember back when I first started writing code with computers I used Q basic and a guy I went to school with was telling me about something
called “peak and poke” or some such thing that allowed you to get to memory addresses, etc, in qbasic if my memory doesn’t fail me.
Is there such a thing with Xojo? Just wondering ?
Dim s As String = "Hello, World!"
Dim nSize As Integer = s.LenB
Dim buffer As New MemoryBlock(nSize)
buffer.StringValue(0,nSize) = s
MsgBox(buffer.StringValue(0,nSize))
True PEEK/POKE allowed you to address a specific memory address anywhere in the system. Modern day OS do not allow you to do that as your application can be running “anywhere” and even move in memory as it runs.
Anything you do with a MemoryBlock is relative to that block and within the protected bounds of that block, not within the application or systems entire memory map
@Tim Lee I remember my Vic20 and my first Amstrad CPC 464 (then a 6128) where many “functions” were only available through peek&poke ! (I always remember an article describing this as “peek-poker” :-))
CPUs at the time were executing instructions and reading data directly from the RAM but modern CPUs do not. Instead, they read data ahead of time and put it in cache memory for faster execution/access. As a consequence, “peek-poker” is at best very slow if possible at all.