Binary File Conversion

WayneRyan

AWF VIP
Local time
Today, 18:53
Joined
Nov 19, 2002
Messages
7,120
I need to read some number of Binary files.

Each file is "mapped" by a very nice SQL Server table:

Code:
Field1   Long
Field2   Char(8)
Field3   Float
Field4   Bit(3)
Field5   Bit(8)
Field6   Bit(5)

Since there are many types of files, I'm thinking of reading
byte-by-byte until end-or-record converting to a binary STRING
as I go. Where's a nice "C" Union declaration when you need it!?
I think a STRING will let me "peel off" sub-integers that are contained
inside a LONG.

Then, as I traverse each field, pull off the correct number of bits
and submit to a conversion algorithm.

The problem is, now I need algorithms for each datatype. Help!

Characters & integers are easy, but floating point?

Am doing research now, if anyone has any ideas, I'd be happy to
hear them.

Wayne
 
It's been a long time since I've had to do anything like that (and it wasn't in VBA anyway). It is done, though, for VBA control of printers in Access. Google for DEVMODE or DEVNAMES or prtDevMode.

I think basically the technique is to define a type the mirrors the binary structure that you have and coerces (is that the word?) the type so you can read the data
 

Users who are viewing this thread

Back
Top Bottom