Below code mainly focused in two question I wanted help.
Question No.1--How to retrieve back the data with toStrDes(which is a pointer to an internal data descriptor points to ),I mean the data,here in this example the data I want to retrieve back is "This is a string",not the internal desciptor address?
Question No.2-- Why retrieving back the data that strptr pointer to in the middile command failed-by failed I mean the result shown in the console with interruption data not the accurate data(see comments in the related line of the source) ,whatever I changed the source encoding or even changed between fbc compilers from 1.09-1.10 to 1.20?
I am expecting an in-depth explanation.
Thanks for the help in advance.
Code: Select all
Dim As String myStr="This is a string"
Dim toStrDes As Any Ptr
Dim toStr As ZString Ptr
toStrDes=@myStr '''pointer to internal data descriptor other than data itself
? "myStr=";"This is a string" '''just to easy trace down and comparison
? "toStrDes:";toStrDes
'''Question No.1--How to retrieve back the data (not the internal desciptor) that toStrDes pointer pointed to?
'? *toStrDes
? "@myStr:";@myStr
toStr=StrPtr(myStr)
? "toStr:";toStr
? "*toStr:";*toStr
myStr="The string is changed to very very ---------------------------------------------------------------long."
? "myStr=";"The string is changed."
? "toStrDes:";toStrDes
? "@myStr:";@myStr
? "toStr:";toStr
Print "*toStr:";*toStr ''''Question No.2---data inerruptions when showing in the console
GetKey()
? "Assign variable again--"
toStrDes=@myStr
toStr=StrPtr(myStr)
? "toStrDes:";toStrDes
? "@myStr:";@myStr
? "toStr:";toStr
? "*toStr:";*toStr