Results 1 to 3 of 3

Thread: console-bug? swallows/casts chars?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    55
    Posts
    1,554
    Rep Power
    174

    console-bug? print swallows chars?

    I was experimenting a little, playing around with heap and such and found some weird behaviour when using Print

    Not sure about the reason but if i use Print to print out single letters in a row
    (String * 1 here, but same happens if using Byte-layover and CHR$(variable) -function)
    somehow the first char does not seem to reach the console-window
    depending on how the string gets composed:

    "string" & {variable|function} [&...]
    or
    {variable|function} & "string" [&...]



    Uses "console"
    
    
    Dim foo As DWord = HEAP_AllocByStr( "hello world!" _
                                         & $CRLF _
                                         & "welcome to thinBasic" )
                                         
    
    PrintL HEAP_Get(foo)
    PrintL
    
    
    Dim char As String * 1 At foo
    
    PrintL "first char: " & $DQ & char & $DQ 
    PrintL
    
    PrintL "run 1: string " & $DQ & "." & $DQ & " in front"
    PrintL
    
    While VarPtr(char) <= HEAP_End(foo) 
    
     Print "." & char 
      
      SetAt( char, VarPtr(char)+1 ) 
    Wend
      
    PrintL Repeat$(2, $CRLF)
    
    
    ' reset
    SetAt(char, foo)
    PrintL "run 2: variable 'char' in front"
    PrintL
    
    While VarPtr(char) <= HEAP_End(foo) 
    
      Print char & "." 
      SetAt( char, VarPtr(char)+1 ) 
    Wend
    
    PrintL Repeat$(2, $CRLF)
    SetAt(char, foo)
    PrintL "where is the " & $DQ & char & $DQ & " ?"
    PrintL $CRLF & " -------------------- key to end"
    
    WaitKey
    
    Last edited by ReneMiner; 30-01-2015 at 13:01.
    I think there are missing some Forum-sections as beta-testing and support

Similar Threads

  1. Console Box and Console Readline
    By TheOne in forum Console
    Replies: 8
    Last Post: 22-03-2011, 18:32
  2. Console Colors
    By danbaron in forum General purpose scripts
    Replies: 0
    Last Post: 30-01-2010, 08:21
  3. console simulation ui
    By Lionheart008 in forum UI (User Interface)
    Replies: 1
    Last Post: 09-01-2010, 11:23
  4. my first console script :)
    By Lionheart008 in forum Console
    Replies: 2
    Last Post: 18-02-2009, 13:14
  5. console scripts
    By sandyrepope in forum Console: source code examples for beginners
    Replies: 4
    Last Post: 16-02-2007, 02:11

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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