Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. #define BLOCK (1 << 14)
  2.  
  3. char *text;
  4. int i, nelem;
  5. FILE *file;
  6.  
  7. /* qua apro file */
  8.  
  9. text = (char *)malloc(BLOCK * sizeof(char));
  10. i = 0;
  11. while((nelem = fread(text + i * BLOCK, BLOCK, sizeof(char), &file)) == BLOCK)
  12. malloc(text, ++i * BLOCK * text);
  13. text[i * BLOCK + nelem] = '\0';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement