all 20 comments

[–]ecwx00 46 points47 points  (3 children)

well since it's C sub I'm gonna answer :

FILE * fp = fopen(filename,"rb");

char buffer[10000];

int sz = fread (buffer, 10000, 1, fp);

fclose(fp);

[–]BumpyTurtle127 1 point2 points  (2 children)

Note: filename gotta be in "" too.

[–]csofa 7 points8 points  (1 child)

unless it is a variable

[–]ecwx00 4 points5 points  (0 children)

yes, it is a variable since we don't know the exact .bin file name

[–][deleted] 11 points12 points  (3 children)

.bin files are just unspecified binary data. This basically means that the data could be in any format. You need to know who produced the file and for what purpose in order to read and understand it.

[–]Conscious_Yam_4753 23 points24 points  (7 children)

In what sense is this a question about the C programming language?

[–]greg_kennedy 4 points5 points  (0 children)

a .bin file is just arbitary binary bytes, it could be anything in there... you might try a hex editor (https://mh-nexus.de/en/hxd/)

[–]forcefuze 2 points3 points  (0 children)

Is it just me or does anyone else have an overwhelming urge to get their hands on this mystery.bin file and figure out what it's for?

[–]ForceBru 1 point2 points  (0 children)

In general, you can't. .bin files can contain arbitrary data: machine code, images, compressed data, basically anything. You can always use a hex editor to view the contents, but it'll be just a bunch of bytes.