Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- char c;
- FILE *from, *to;
- from = fopen("file.txt", "r");
- to = fopen("copy.txt", "w");
- if (from == NULL)
- {
- perror("file.txt");
- exit(1);
- }
- /* file exists, so start reading */
- while ((c = getc(from)) != EOF)
- putc(c, to);
- fclose(from);
- exit(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement