Just got bitten with this fellow, and a few searches didn't throw it up... If a local string has the same name as a TYPE, then some elements of the TYPE definition apply - unexpectedly in my case ;-)
Here's a trivial demo:
Code: Select all
' Nasty problem with String handling (May, 2015)
' Checked with only FB 1.02.1, and under only Windows (Win7-64)
#include once "crt\win32\time.bi" 'Only to get at the "TM" structure (9 * LONGs, 36 bytes)
Sub Show_String()
Dim as string tm
Dim as integer i
tm = "123"
Print "String/TYPE problem/bug.....": print
Print " TM: String =["; tm; "], expecting [123]."
Print " TM: Len(tm)="; Len(tm); ", expecting 3."
Print
If Len(tm) > 0 Then
For i = 1 to len(tm)
Print Hex(Asc(Mid(tm,i,1)),2);" ";
Next i
Print
EndIf
End Sub
Show_String()
Print: Print "Done, Sleeping...";: Sleep: Print: Close: End
Should we/I post this as a "Bug" - assuming it has not been posted/resolved already?
Best regards,
- Mike