Hi! I'm trying to create a copy of a C file, but I'm not able to copy the content, it's just creating a new blank file, can anyone see where I'm going wrong?
#include <stdio.h>
int main() {
char str[100];
FILE *file = fopen("/home/ananda/Downloads/pratica12/GAAL.txt", "r");
if(file == NULL){
printf("arquivo inexistente\n");
return 0;
}
FILE *file1 = fopen("/home/ananda/Downloads/pratica12/GAAL2.txt", "w");
if(file == NULL){
printf("arquivo inexistente\n");
return 0;
while (fgets (str, 100, file) != NULL){
fputs(str, file1);
return 0;
}
}
}