Results 1 to 2 of 2

Thread: Virtual dynamic Strings

  1. #1
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    52
    Posts
    1,470
    Blog Entries
    2
    Rep Power
    163

    Virtual dynamic Strings

    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...
    Last edited by ReneMiner; 03-04-2022 at 09:25.
    running thinBasic in HP Pavillon Desktop 590 a0xxx 8GB Ram AMD A6-9225 Radeon R4 5Compute Cores 2C+3G @2.6GHz

    Windows 11 Enterprise x64 Build 22000.100 (21H2) - "native boot" from .vhdx
    (says the systeminfo. anything else says it were Windows 10 - but hey: thinbasic runs well )


  2. #2
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    52
    Posts
    1,470
    Blog Entries
    2
    Rep Power
    163
    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
    running thinBasic in HP Pavillon Desktop 590 a0xxx 8GB Ram AMD A6-9225 Radeon R4 5Compute Cores 2C+3G @2.6GHz

    Windows 11 Enterprise x64 Build 22000.100 (21H2) - "native boot" from .vhdx
    (says the systeminfo. anything else says it were Windows 10 - but hey: thinbasic runs well )


Similar Threads

  1. VR, virtual reality, AR
    By alberto in forum Suggest new module
    Replies: 2
    Last Post: 04-01-2019, 00:03
  2. With {As|Like} vartype At- a virtual idea
    By ReneMiner in forum Suggestions/Ideas discussions
    Replies: 0
    Last Post: 30-01-2015, 19:57
  3. Microsoft Virtual PC 2007 SP1
    By ErosOlmi in forum Technology
    Replies: 3
    Last Post: 22-05-2008, 00:02

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •