putw() in C language | Detail

fputw() in C language

fputw is basically use to write an integer value in the file. For more detail read further.

putw function in c

Through this article we will be going to discuss putw( ) function of C in detail in which we will cover following topics.

  1. putw( ) function in c
  2. header file for putw( ) function in c
  3. return value of putw( ) function in c
  4. putw( ) function in c syntax
  5. 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;
}

____________________________________

example of putw function in c

____________________________________

Conclusion

The putw function is basically used to write an integers value in the stream(file).
Post a Comment (0)
Previous Post Next Post