Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Loads a file into memory dynamically allocated on heap.
- * Stores address thereof in *content and length thereof in *length.
- */
- bool load(FILE* file, BYTE** content, size_t* length)
- {
- BYTE *buf = NULL;
- int counter = 0;
- while(feof(file)==0)
- {
- fread(buf,sizeof(buf), 1, file);
- BYTE* store = malloc(sizeof(BYTE));
- *store = *buf;
- if(counter == 0)
- *content = store;
- counter++;
- }
- *length = counter;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement