DragonOsman

load() in pset6 - server.c

Dec 1st, 2016
101
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bool load(FILE* file, BYTE** content, size_t* length)
  2. {
  3.     int c;
  4.     *content = NULL;
  5.     *length = 0;
  6.     while ((c = fgetc(file)) != EOF)
  7.     {
  8.         *content = realloc(*content, *length + 1);
  9.         if (*content == NULL)
  10.         {
  11.             exit(1);
  12.         }
  13.         (*content)[*length] = c;
  14.         (*length)++;
  15.     }
  16.     return true;
  17. }
RAW Paste Data