writing data to a file in c code example
Example 1: write a binary file c
FILE *write_ptr;
write_ptr = fopen("test.bin","wb"); // w for write, b for binary
fwrite(buffer,sizeof(buffer),1,write_ptr); // write 10 bytes from our buffer
Example 2: file in C
//to open a file
FILE=*fp;
fp=fopen("one.txt", "w");
//to close file
fclose(fp);