Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- int main (int argc, char* argv[]) {
- FILE *SourceFile, *TargetFile;
- char ch;
- char* source = argv[1];
- char* target = argv[2];
- SourceFile = fopen(source,"r");
- if (SourceFile == NULL) {
- printf("Error opening file: %s", source);
- return 1;
- }
- TargetFile = fopen(target,"w");
- if (TargetFile == NULL) {
- printf("Error opening file: %s", target);
- return 1;
- }
- while((ch = fgetc(source)) != EOF) {
- fputc(ch, target);
- }
- fclose(source);
- fclose(target);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement