I want the program can do that for me.
When I enter the name of file in the same folder of .exe, the program will scan the file data and print it out the data in order.
However, i do not know how to scan the data in the file and print it out.
And i do not know why i enter the file name( which in the same folder of .exe), and it shows that can't find the file.
FILE * inputFile = NULL;
char c = ' ';
if(argc > 1)
strncpy(filename, argv, FILENAME_MAX);
puts("Press Enter the name of the File from which to read the data : ");
fgets(filename, FILENAME_MAX, stdin);
inputFile = fopen(filename, "r");
if(inputFile == NULL)
printf("Cannot open file %s for input. Press Enter to quit", filename );
while((c = (char)getc(inputFile)) != EOF)
if(c == ' ')
c = '\n';
puts("Press any key to Continue");