Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need to decode this into VFP
Message
From
16/12/2009 09:54:28
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01439276
Message ID:
01439342
Views:
81
>I would like to translate this code into foxpro, or find a better way. I have been working on it for some time now and have hit a wall. Any ideas?
>
>
>Function Decode_LoopData (Value As String) As Integer
>
>    'Decode raw data bytes from "loop" command to numeric value
>' NOTE
>' Low bit is left char in value
>' High bit is right char in value
>
>If Len(Value) = 1 Then
>     Decode_LoopData = Val("&H" + Hex$(Asc(Value)))
>ElseIf Len(Value) = 2 Then
>    temp% = Asc(Left$((Value), 1))
>    If temp% < 16 Then
>	Decode_LoopData = Val("&H" + Hex$(Asc(Right$(Value, 1))) + "0" + Hex$(temp%))
>    Else
>	Decode_LoopData = Val("&H" + Hex$(Asc(Right$(Value, 1))) + Hex$(temp%))
>    End If
>    
>End If  
>
>
It is doing this in a complicated and hardcoded way:
? CTOBIN(CREATEBINARY(m.lcValue),'RS')
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform