GirlsCanCode

Pastebin

Dec 3rd, 2016
76
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (file == NULL)
  2.     {
  3.         return false;
  4.     }
  5.     char* buffer = malloc(sizeof(char));
  6.     int size = 0;
  7.     for (char c = fgetc(file); c != EOF; c = fgetc(file))
  8.     {
  9.         buffer[size] = c;
  10.         size++;
  11.         buffer = realloc(buffer, sizeof(char));
  12.     }
  13.     *content = &buffer;
  14.     *length = size;
  15.     return true;
RAW Paste Data