Friday, 30 March 2012

Integer oriented input / output function


Integer oriented input / output function
putw()

This function is used to write integer value.

Syntax:
                   putw(int,File_ptr);
Here , first argument is the integer value which wanted write in file. File_ptr is the pointer to file.
Ex,
FILE *fp;
fp = fopen(“number.txt”, “w”);
int n=10;             
putw(n,fp);

getw()

This function is used to read integer value from file.

Syntax:
int getw(File_ptr);

It returns an integer value from the file specified in File_ptr.
Ex,
FILE *fp;
fp = fopen(“number.txt”, “r”);
int n;          
n=getw(fp);


Posted By  ;Ruchita Pandya

No comments:

Post a Comment