I'm new on stackoverflow ! I have a problem with my code. I would have liked to know how can I improve my code so that it copies all kinds of files without error? For example, only .log files get copied without worry. But I would like to copy also the files .JPG, .zip, .... When I try with this kind of extension, the copy always gets an error. Thank you in advance for your answers
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#define MAX_CHAR 255
int main(int argc, char * argv[])
{
    FILE * sourceFile = fopen(argv[1], "r");    
    FILE * destFile = fopen(argv[2], "w");    
    char line[MAX_CHAR];
    while (fgets(line, MAX_CHAR, sourceFile) != NULL)
    {
        fputs(line, destFile);
    }
    fclose(sourceFile);
    fclose(destFile);
}
 
    