#include #include // Error checking int main() { FILE *in; int i; in = fopen("dat.txt", "r"); // dat.txt instead of data.txt if(in == NULL) // fopen returns a NULL pointer if it fails to open the file for any reason printf("File not found!\n"); else { fscanf(in, "%d", &i); // read a single integer from the file printf("i=%d\n", i); // print it on the screen fclose(in); } system("pause"); }