I'm working on a program and it's something I can't understand. I have a main function with arguments:
int main(int argc, const char *argv[]){
FILE *file;
file=fopen(argv[1], "r");
if( file == NULL )
{
perror("Error while opening the file.\n");
exit(EXIT_FAILURE);
}
How do I read the argv[1]
file. When I compile it error shows up as Invalid argument. How do I get the file to open so I can print the things it's hiding? I'm using Code Blocks.