PDA

View Full Version : Virtual dynamic Strings



ReneMiner
03-04-2022, 09:20
Impossible? Who said that?


'---Script created on 04-03-2022 08:21:35 by ReneMiner


uses "console"

' - - - real string
string a = "Hello"

' - - - data for the virtual string
dword b = heap_allocbystr(mkdwd$(5) & "World")



' allocated above a dynamic String-structure:
' StrLen As Dword & bChar(StrLen) As Byte


dword C = b + 4 ' <<< virtual StrPtr

string V ' virtual string <<<

' real string output:

Print a & $spc



memory_swap(varptr(V), varptr(c), 4) 'place a layover


' virtual string output:

printl V & " !"



memory_swap(varptr(V), varptr(c), 4) 'put it back

waitkey


'hints
'printl "Varptr( a ) " & str$(Varptr( a ))
'printl "StrPtr( a ) " & Str$(Strptr( a ))
'printl str$(peek(Dword, varptr(a)))






of course - it's virtual.
Not real but not a fake neither.

Allows using the "fast" string methods on memory. The keywords in the string-functions list that end with F
sadly no InstrF available...

ReneMiner
06-04-2022, 17:07
i thought this would loose an avalanche... but if no one reads it - nobody will ever know.

guess i must create a module to make use oif this and everyone will be surprised - except the reader of this thread :D