So what I'm trying to do is input choice a and then input a file name to open. But instead, it is using the input for the switch statement as "gets" as well as for the menu choice. Down below is what I have so far. I have tried swapping out getc with "gets" that didn't work. I tried putting a "\n" in the scanf. That didn't work.
This is what it's supposed to look like:
This is what what I have now:
char choice = 'a';
//Display menu
printf("a. Enter file location(fullpath)\n");
printf("b. Display the labyrinth\n");
printf("c. Enter a box size\n");
printf("d. Enter a box size\n");
printf("e. Valdate path\n");
printf("f. exit\n");
scanf("%c\n", &choice);
if (choice == 'a')
{
char inputFile[1000], ch;
//a).Read fullpath for the input file
getc(inputFile);
FILE* file;
file = fopen(inputFile, "r");
if (file == NULL)
{
printf("Failed to open file");
printf("Goodbye");
return 0;
}
else
{
printf("File opened successfully\n");
}
}