Guest User

Untitled

a guest
Aug 1st, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. bool load(FILE* file, BYTE** content, size_t* length)
  2. {
  3. if(file == NULL)
  4. {
  5. return false;
  6. }
  7. int c = 1;
  8. int count = 0;
  9. char* buffer = malloc(sizeof(char));
  10. char* apple = buffer;
  11. while((c=fgetc(file)) != EOF)
  12. {
  13. buffer[count] = c;
  14. count++;
  15. apple = realloc(buffer, count);
  16. if(apple == NULL)
  17. {
  18. continue;
  19. }
  20. }
  21. *content = buffer;
  22. *length = count;
  23. fclose(file);
  24. return true;
  25. }
Add Comment
Please, Sign In to add comment