I have a Hex file created by CashRegister Machine. I have to read this file in.
File uses formatting detailed below. It is like socket packets.
Code Data : 2 Byte
PLU Code Data: 7 Byte
Unit Price Data: 5 Byte
Quantity Data: 5 Byte
Total Amount Data: 5 Byte
PLU Name Data: 18 Byte
Tax Rate Data: 1 Byte
Length: 24 + 19 Byte
- PLU code format is BCD
- Unit price 1-9999999999 (BCD)
- quantity 1-9999999999 (BCD last 3 numbers should be decimal)
- total amount 1-9999999999 (BCD)
I read in the hex file with a binary reader and then insert int the Unit Price byte array.
byte[] bytes = { data[21], data[22], data[23], data[24], data[25] }; // BCD Byte Array
This array is Unit Price. But how can I then convert this number to decimal. And the information says that for quantity : BCD last number should be decimal--what does this mean? Thanks.