Well, while I wait for an answer for my question I guess it wouldn't hurt to answer yours.
First you have to find the length of the file - if you're using stdio.h file functions, fseek to the end of the file, and then use fgetpos. it will return the length of the file. Then, allocate a buffer with malloc that is as long as the file, and fread from the file into the buffer. That's the clumsiest way of doing it, however... but it should give you an idea of where to start. It should also break down the large question you asked into several smaller questions...