I need to pass two files through my program in command line form
./your_executable inputfile.txt outputfile.txt
In my example, I'm using
gcc coursework.c CircleCode.txt CircleCode_tmp.txt
Therefore the second file doesn't exist and is opened in the program.
int main(int argc, char **argv[])
{
FILE *orginalFile = fopen(*argv[1], "r");
FILE *newFile = fopen(*argv[2], "w");
if (orginalFile == NULL || newFile == NULL)
{
printf("Cannot open file");
exit(0);
}
}
The error in Clang:
error: no such file or directory: 'CircleCode_tmp.txt'