View Poll Results: What will theString contain after "Dim theString as String * 1"

Voters
1. You may not vote on this poll
  • Chr$(0)

    0 0%
  • $CRLF

    0 0%
  • " ", one Space, CHR$(32)

    1 100.00%
  • "", empty

    0 0%
  • $CR

    0 0%
  • $LF

    0 0%
  • EOF

    0 0%
  • something else

    0 0%
Results 1 to 2 of 2

Thread: len-fixed strings

  1. #1
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,530
    Rep Power
    171

    len-fixed strings

    Dim theString as String * 1
    
    So Question is: What will theString contain now?
    Last edited by ReneMiner; 21-02-2013 at 13:38.
    I think there are missing some Forum-sections as beta-testing and support

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Oh no,

    I was so sure it will be $SPC ... but it is $NUL!

    Let's undo my mistake by giving some sample code on how to determine ascii value of given string character:
    Uses "Console"
    
    Function TBMain()
    
      Dim theString As String * 1
      Byte asciiValue1
      
      asciiValue1 = Asc(theString)
      PrintL "ASC(s):", asciiValue1
    
      asciiValue1 = Asc(theString, 1)
      PrintL "ASC(s,1):", asciiValue1
      
      Byte asciiValue2 At StrPtr(theString)
      PrintL "Virtual variable:", asciiValue2
    
      asciiValue1 = Peek(Byte, StrPtr(theString))
      PrintL "Peek:", asciiValue1
      
      Byte asciiValue3( Len(theString) ) At StrPtr(theString)
      PrintL "Virtual array:", asciiValue3(1)
    
      PrintL
      PrintL "Press any key to continue..."  
      WaitKey
      
    End Function
    
    Petr
    Last edited by Petr Schreiber; 21-02-2013 at 18:46.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Similar Threads

  1. Freebasic Strings again
    By Michael Clease in forum Module SDK (Freebasic version)
    Replies: 7
    Last Post: 20-05-2013, 03:27
  2. FreeBasic strings
    By ErosOlmi in forum Module SDK (Freebasic version)
    Replies: 12
    Last Post: 21-11-2008, 08:28

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
  •