fputw() in C language
fputw is basically use to write an integer value in the file. For more detail read further.
Through this article we will be going to discuss putw( ) function of C in detail in which we will cover following topics.
- putw( ) function in c
- header file for putw( ) function in c
- return value of putw( ) function in c
- putw( ) function in c syntax
- putw( ) function in c program
putw( ) function in C
The putw( ) function is nothing but, it is a standard library function of C and it also called file handling function which is basically used to write integer value in the stream(file).
Header file for putw( ) function in C
This file function is define in <stdio.h> which is stand for standard input-output header file.
Return value of putw( ) function in C
putw( ) function return an integer written to the file on success and if error occur than it returns End of File(EOF).
Syntax of putw( ) function in C
int fputw(int value , FILE *pointer):
Example of putw( ) function in C
#include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *fptr;
int value;
fptr=fopen("num.dat","wb");
for(value=1;value<=30;value++)
putw(value,fptr);
fclose(fptr);
return 0;
}
____________________________________
____________________________________
Conclusion
The putw function is basically used to write an integers value in the stream(file).

