D
Dominik G
Hi,
I have to use Java to read a binary file. This looks easy (yes, I've
read the tutorial on Sun's website). The problem is that the files
were created by a C program. I don't know the exact file format, but I
have the C source code.
The first entry is grabbed like that:
fread(query_length, sizeof(long), 1, file)
Since query_length is a pointer to something of type long (four-byte
signed integer), I expect that this in Java should be:
int seqLen = myDataInputStream.readInt();
.... but unfortunately it does not work. I am getting 172777843 instead
of 56.
Does anybody have an idea what I am doing wrong? Maybe some ideas for
reverse engineering? As I said, I don't know the file format, but I
have a working C code (including source) that I may use to encode my
own data.
Best regards,
James
I have to use Java to read a binary file. This looks easy (yes, I've
read the tutorial on Sun's website). The problem is that the files
were created by a C program. I don't know the exact file format, but I
have the C source code.
The first entry is grabbed like that:
fread(query_length, sizeof(long), 1, file)
Since query_length is a pointer to something of type long (four-byte
signed integer), I expect that this in Java should be:
int seqLen = myDataInputStream.readInt();
.... but unfortunately it does not work. I am getting 172777843 instead
of 56.
Does anybody have an idea what I am doing wrong? Maybe some ideas for
reverse engineering? As I said, I don't know the file format, but I
have a working C code (including source) that I may use to encode my
own data.
Best regards,
James