Page 21 - PROGRAMMING IN C_Neat
P. 21
7. getw():
Used to read an integer value from a file.
Example:
int n;
n = getw(fptr);
8. putw():
Used to write an integer value to a file.
Example:
putw(6, fptr);
9. fscanf():
File scanf().
Used to read data from a file.
Example:
fscanf(fptr, “%d %s %f”, &rollno, name, &percentage);
10. fprintf():
File printf().
Used to write data to a file.
Example:
fprintf(fptr, “%d %s %f”, rollno, name, percentage);
_______________________________________________________________________________________
13. Explain the important functions available in <ctype.h> header file. OR Explain the character
oriented functions. *
Character Oriented Functions:
Character oriented functions are stored in the ctype.h header file.
1. isdigit():
Used to check whether a given character is a digit or not.
General Form:
int isdigit(c);
Example 1:
c = ‘6’; Output:
int n = isdigit(c); n = 1 (non-zero)
Example 2:
c = ‘K’ Output:
int n = isdigit(c); n = 0
2. isalpha():
Used to check whether a given character is an alphabet or not.
General Form:
int isalpha(c);
Example 1:
c = ‘K’; Output:
int n = isalpha(c); n = 1 (non-zero)