wau
asked on
binary struct reading from file. How to?
I have a file written from MSVC++ 6.0 like:
typedef struct My_format{
short num_1;
char name_1[4];
short num_2;
char name_2[10];
}My_format;
This structure repeats every 256 bytes.
I have to read this from Java. The only class that has readShort() method is RandomAccessFile. Do I have to read the members of the struct one by one? Or is there any method to do buffered reading?
If I read in an array of bytes, how can I convert the corresponding bytes to short/char[] ?
Thanks.
typedef struct My_format{
short num_1;
char name_1[4];
short num_2;
char name_2[10];
}My_format;
This structure repeats every 256 bytes.
I have to read this from Java. The only class that has readShort() method is RandomAccessFile. Do I have to read the members of the struct one by one? Or is there any method to do buffered reading?
If I read in an array of bytes, how can I convert the corresponding bytes to short/char[] ?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.