getw() in C language | Detail

 getw() in C language

getw( ) function in C, is basically used in file handling for reading an integer value from the file.

getw in c language

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

  1. gettw( ) function in c
  2. header file for getw( ) function in c
  3. return value of getw( ) function in c
  4. getw( ) function in c syntax
  5. getw( ) function in c program

getw( ) function in C

The getw( ) function is nothing but, it is a standard library function of C and it also called file handling function which is basically used to read an integer value from the stream(file).

Header file for getw( ) function in C

This file function is define in <stdio.h> which is stand for standard input-output header file.

Return value of getw( ) function in C

getw( ) function return an integer written to the file on success and if error occur than it returns End of File(EOF).

Syntax of getw( ) function in C

int fgetw(FILE *pointer):

Example of getw( ) function in C

#include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *fptr;
int value;
fptr=fopen("num.dat","rb");
while((value=getw(fptr))!=EOF)
printf("%d\t",value);
fclose(fptr);
return 0;
}

____________________________________

Example of getw function in c

____________________________________

Conclusion

The getw( ) function is basically used in file handling to read integer value from the file.
Post a Comment (0)
Previous Post Next Post