-
November 23rd, 2015, 10:02 AM
#1
Converting C++ into Java - Binary little-endian architectures
I am newbie, I am trying to read data from the binary {each record written in little Endian binary format}, so the following code I found it through search! could anyone help to convert C++ into Java please...
int main()
unsigned char bytes[4];
int sum = 0;
FILE *fp=fopen("file.txt","rb");
while ( fread(bytes, 4, 1,fp) != 0) {
sum += bytes[0] | (bytes[1]<<8) | (bytes[2]<<16) | (bytes[3]<<24);
}
return 0;
}
Thanks in advance!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|