Check out example codes for "c file". It will help you in understanding the concepts better.

Code Example 1

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

int main() {
   	printf("Hello Word!");
    return 0;
}

Code Example 2

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

int main() {
    char sentence[1000];

    // creating file pointer to work with files
    FILE *fptr;

    // opening file in writing mode
    fptr = fopen("program.txt", "w");

    // exiting program 
    if (fptr == NULL) {
        printf("Error!");
        exit(1);
    }
    printf("Enter a sentence:\n");
    fgets(sentence, sizeof(sentence), stdin);
    fprintf(fptr, "%s", sentence);
    fclose(fptr);
    return 0;
}

Code Example 3

#include<stdio.h>
int main(){
	FILE *in=fopen("name_of_file.txt","r");
	char c;
	while((c=fgetc(in))!=EOF)
		putchar(c);
	fclose(in);
	return 0;
}

Code Example 4

//to open a file
FILE=*fp;
fp=fopen("one.txt", "w");
//to close file 
fclose(fp);

Learn ReactJs, React Native from akashmittal.com