C - fwrite
File Operations in Tamil
C - fwrite
- fwrite function writes the content in the file.
![c-fwrite](https://wikitechy.com/cdn/tutorials/c-programming/fwrite.gif)
C Syntax
fwrite(ptr, size, count, FILE *stream)
ptr − The pointer to the array of elements to be written.
size − Size of each object
count − The number of the objects
stream − pointer to the output stream
Example
#include <stdio.h>
#include <conio.h>
int main()
{
char a[10]={'1','2','3','4','5','6','7','8','9','a'};
FILE *fp;
fp=fopen("one.txt","w");
fwrite(a,1,10,fp);
fclose(fp);
getch();
return 0;
}
Output
![c-fwrite](https://wikitechy.com/cdn/tutorials/c-programming/fwrite-c.gif)
Learn C - C tutorial - C fwrite - C examples - C programs