Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting String to Byte
Message
From
28/11/2011 22:12:15
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Converting String to Byte
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01529948
Message ID:
01529948
Views:
78
I have the following code (this works) which gets a byte (SAFEARRAY) from an ActiveX component and saves to a file:
LOCAL ARRAY laHotKeys[1] AS Byte
laHotKeys = 0
COMARRAY(this.Globals,10)
this.Globals.GetHotKeys(@laHotKeys)
lcFileName = GKKGetConfigPath() + "UserKeyBindings.txt"
STRTOFILE(laHotKeys[1],lcFileName)
I am then trying to read back in the file with the following code:
LOCAL ARRAY laHotKeys[1] AS Byte
COMARRAY(thisform.CodeMax.Globals,10)
laHotKeys[1] = CREATEBINARY(FILETOSTR("GKKKeyBindings.txt"))
this.Globals.SetHotKeys(@laHotKeys)               && Failing here with invalid datatype
I can set a breakpoint and see the value at laHotKeys[1] is in the correct format. However, when the SetHotKeys method is called the value in the array is changed and the error is trapped.

What is the correct way to convert a string that was previously a byte array saved to file and then re-read in? Thank you.
Reply
Map
View

Click here to load this message in the networking platform