QP School
File pointers and streams in C - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: C 18 Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=32)
+--- Thread: File pointers and streams in C (/showthread.php?tid=5100)



File pointers and streams in C - Qomplainerz - 07-25-2023

File pointers are used to interact with files.

FILE *file = fopen("data.txt", "r");
if (file != NULL) {
    int ch;
    while ((ch = fgetc(file)) != EOF) {
        putchar(ch); // Output: Contents of the file
    }
    fclose(file);
}