so I'm trying to set my file modes with command line arguements, and with this conditional statement the program isn't working as intended. But without conditions, it's fine, any ideas?
int main(int argc, char *argv[]) {
FILE* outfil;
FILE* infil;
if(strcmp(argv[1], "-i") == 0){
infil = fopen(argv[2], "r");
outfil = fopen(argv[4], "w");
}
else if(strcmp(argv[3], "-i") == 0){
outfil = fopen(argv[2], "w");
infil = fopen(argv[4], "r");
}
else{
printf("Invalid command line usage.");
return 1;
}
}