Definition | #include <stdio.h> int getw(FILE *fp);
A machine word may be conceived of as a binary | |
Return val. | word read as an | |
if successful. | ||
EOF | or end of file or error. | |
Notes | Since word length and byte arrangement are system-dependent, it is possible that files Since EOF represents a valid The following applies in the case of text files with SAM access mode and variable record | |
Example | The following program fragment reads wordwise from the file with file pointer fp until end of int buf[MAX];
int i = 0;
FILE *fp;
while(!feof(fp) && !ferror(fp))
buf[i++] = getw(fp);
| |
See also | putw | |