I am doing an assignment for class where the user is prompted for a file name, the program then does stuff to the information in the file, and then prints out a graph to the console.
The issue I am getting is reading in the char array. Here is my current code for opening the file:
The problem I am having is that the char array doesnt seem to be reading in like intended. Can anyone help me out with how to correct read in an array of chars? I am receiving this character when I print out the fileName array in the debugging printout: ≡Code://Create file, in for input FILE *in; //Create char array for file name char fileName[50]; //Prompts user for file name input printf("Please type the name of the file: "); //Get file name scanf("%c",fileName); //Debugging Here printf("File Name: '%c'\n",fileName); //Open input file in = fopen(fileName,"r");
Any thoughts? The project is due midnight tonight (12 hours), so any swift help is appreciated.