I want the user to give me the full path where the file exists and not just the file name. How do I open the file this way?
Is it something like this:
if
The code seems working to me. I think the same with @Iothar.
Check to see if you include the required headers, to compile. If it is compiled, check to see if there is such a file, and everything, names etc, matches, and also check to see that you have a right to read the file.
To make a cross check, check if you can open it with fopen..
FILE *f = fopen("C:/Demo.txt", "r");
if (f)
printf("fopen success\n");