/* Example: fopen in C language */ #include <stdio.h> #include <stdlib.h> #include <stdio.h> #include <stdlib.h> int main () { FILE * fp; fp = fopen ("file.txt", "w+"); // Open file in write mode fprintf(fp, "%s %s %s %d", "We", "are", "in", 2017); // write data fclose(fp); // close the file return(0); }