File handling in C allows you to perform operations like reading, writing, and opening files.
#includeint main() { FILE *file; file = fopen("example.txt", "w"); if (file == NULL) { printf("Error opening file.\n"); return 1; } fprintf(file, "Hello, file!\n"); fclose(file); return 0; }
This program demonstrates how to open a file for writing, write to it, and close it.