A Program Read data from File C Programming Home » C File Input/Output » Write data into File and Read from File // C program to implement // the above approach #include #include #include // Driver code int main() { FILE* ptr; char ch; // Opening file in reading mode ptr = fopen("Student.txt", "r"); if (NULL == ptr) { printf("file can't be opened \n"); } printf("Content of this Student's 'file are \n\n"); // Printing what is written in file // character by character using loop. do { ch = fgetc(ptr); printf("%c", ch); // Checking if character is not EOF. // If it is EOF stop eading. } while (ch != EOF); // Closing the file fclose(ptr); getch(); return 0; } Tweet Share Share Share Share Related Post
ConversionConversion EmoticonEmoticon