Structs arn't working.
Posted: Tue Nov 08, 2005 5:11 am
I have a problem with a struct in C. It's mapped a file entry in the ISO format and compiles with the documentation, etc.
The size of the table I have to read is 34 bytes, when I look at the iso image in a hex editor, the entries are 34 bytes. Looking at the values in the struct, it's 34 bytes (not including the potential characters at the end for its name).
Like this:
typedef struct {
unsigned char
unsigned char
unsigned long
unsigned long
unsigned long
unsigned long
unsigned char
unsigned char
unsigned char
unsigned char
unsigned char
unsigned char
unsigned char
unsigned char
unsigned char
unsigned char
unsigned short
unsigned short
unsigned char
char[31]
} DirectoryStructure;
But when it comes to reading the thing, the last value (the start of the actual filename) is out of place by two bytes. This doesn't make any sense at all. To make it clearer, "SYSMAIN.BIN" comes out as "SMAIN.BIN"
What am I doing wrong?
The size of the table I have to read is 34 bytes, when I look at the iso image in a hex editor, the entries are 34 bytes. Looking at the values in the struct, it's 34 bytes (not including the potential characters at the end for its name).
Like this:
typedef struct {
unsigned char
unsigned char
unsigned long
unsigned long
unsigned long
unsigned long
unsigned char
unsigned char
unsigned char
unsigned char
unsigned char
unsigned char
unsigned char
unsigned char
unsigned char
unsigned char
unsigned short
unsigned short
unsigned char
char[31]
} DirectoryStructure;
But when it comes to reading the thing, the last value (the start of the actual filename) is out of place by two bytes. This doesn't make any sense at all. To make it clearer, "SYSMAIN.BIN" comes out as "SMAIN.BIN"
What am I doing wrong?