The code I have is as follows:
FILE *txt_file = fopen(\"data.txt\", \"r\");
if (txt_file == NULL) {
perror(\"Can\'t open file\");
}
Th
Make sure that your input file is in the same directory as the executable, which may be different than the one where your source files are kept. If you're running the program in an IDE debugger, make sure that your working directory is set to the location of the input file. Also, if you're running in *nix rather than Windows, you may need to prepend a "./" to the input filename.