Read variable length binary files into memory???
Posted on 2003-02-28
I'm teaching myself C, for Cocoa later on, so _please_ forgive my C newbie factor of 10. :)
I need to read variable lengths of the rest of a binary files (typically 80k-150k), from a variable offset in the file, and can't figure out how to do this.
In my admittedly lacking mind, here's how it should work:
i = fread(&fnsz, 4, 1, fp);
fnsz = NSSwapInt(fnsz);
const void *act_file;
act_file = malloc(fnsz);
i = fread(&act_file, fnsz, 1, fp);
Thanks in advance, for any help, more C tutorials, directions, etc.