How to close a file in C

1 Answer

0 votes
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    FILE* fp = fopen("d:\\data.txt", "r");

    if (!fp) {
        perror("File opening failed");
        return -1;
    }

    fclose(fp);
}





/*
run:



*/

 



answered Jan 28, 2023 by avibootz
...