Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(void)
- {
- char *content;
- long filesize;
- FILE *fp = fopen("input.txt", "rb");
- if (fp == NULL)
- {
- return 1;
- }
- else
- {
- fseek(fp, 0, SEEK_END);
- filesize = ftell(fp);
- rewind(fp);
- content = malloc((filesize + 1) * (sizeof(char)));
- fread(content, sizeof(char), filesize, fp);
- fclose(fp);
- content[filesize] = 0;
- }
- printf("%s\n", content);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement