File Read and Display

#include <stdio.h>

int main() {
    // File read and display
    FILE *file;
    char buffer[100];

    file = fopen("display.txt", "r");
    if (file != NULL) {
        while (fgets(buffer, sizeof(buffer), file) != NULL) {
            printf("%s", buffer);
        }
        fclose(file);
    } else {
        printf("Unable to open the file.\n");
    }

    return 0;
}
chevron_left
chevron_right

Leave a comment

Your email address will not be published. Required fields are marked *

Comment
Name
Email
Website