Byte Conversion 
Author Message
 Byte Conversion

I am using PB 3.1 and need to convert a three byte binary value read from
disk to a numerical value in PB. I can use CVWRD for 2 byte strings and
CVDWD for 4 byte strings but how do I do 3 byte strings?

Thanx



Mon, 18 Mar 2002 03:00:00 GMT  
 Byte Conversion

Quote:

> I am using PB 3.1 and need to convert a three byte binary value read from
> disk to a numerical value in PB. I can use CVWRD for 2 byte strings and
> CVDWD for 4 byte strings but how do I do 3 byte strings?

> Thanx

If it's an integer:
Add a CHR$(0) to the end of the 3 bytes, then use CVDWD.
That is if you're using a PC. If you're on a Mac you'll have to add it
in front.
If it could be signed you'll have to compensate for that next.

--
Peter Manders.
Please remove the 'u' to reply.



Mon, 18 Mar 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Byte conversion need Endian determination method

2. Byte/GB Level Conversion

3. conversion functions for Microsoft Basic 4 and 8 byte numeric format

4. Byte stream conversion using variances

5. Intel Bit/Byte Order Conversion for Alsys Ada ?

6. Conversion to/from Byte Array

7. Byte to integer conversion

8. Byte to Decimal string conversion ?

9. A little gift (Hex to Byte/Byte to Hex)

10. I want to generate a CRC (2 bytes) and I have 31 bytes in my frame

11. Byte Array to Byte

12. Bytes at serial port dropping bytes

 

 
Powered by phpBB® Forum Software