Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to access byte arrays in VFP
Message
From
20/09/2002 03:58:06
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
19/09/2002 14:38:36
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00702387
Message ID:
00702620
Views:
9
>Hi
>I am using the MSComm control within a VFP app to capture serial data. If you use the comm control to receive binary data, it is stored in the controls receive buffer as a byte array. How can I access this byte array from VFP in order to write the data out to a file?
>
>Thanks and regards
>Bill

Bill,
I never tried MScomm with binary data but guess it's like VFP to SQL server's image type. Each byte value is converted to its hex char representation while sending and converted back to one byte on receiving end (ie: 255 goes as "FF"). If so get the data as string first and then write out in pairs :

for ix=1 to len(Str) step 2
=fwrite(hout,evaluate('0x'+substr(Str,ix,2)))
endfor

PS: A byte array might represent the actual binary data as is, a structure, a unicode string (strconv()) etc. W/o knowing the format what I said might be totally wrong.
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