Google News
logo
getw and putw functions In C Language
These are integer-oriented functions. They are similar to getc and putc functions and are used to read and write integer values. These functions would be useful when we deal with only integer data. The general forms of getw and putw are: putw(integer, fp ); getw(fp); 
  getw() Example :
#include<stdio.h>
main()
{
  FILE *fp;
  int ch; 
  fp=fopen(“file1.txt”,”r”);
  ch=getw(fp);
  printf(“%d”, ch);
  fclose(fp);
}
  putw() Example :
#include<stdio.h>			
main()
{
    FILE *fp;
    fp=fopen(“file1.txt”,”w”);
    putw(97,fp);
    fclose(fp);
}