Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
getw - read word from stream
&pagelevel(4)&pagelevel
Syntax | #include <stdio.h> int getw(FILE *stream); |
Description | getw() reads the next word from the input stream pointed to by stream. The size of a word is the size of an int and may vary from machine to machine. The getw() function presumes no special alignment in the file.
getw() can mark the structure component st_atime for the file to which stream is assigned for changing (see sys/stat.h ). The structure component st_atime is updated as soon as fgetc(), fgets(), fgetwc(), fgetws(), fread(), fscanf(),
getc(), getchar(), gets() or scanf() are called successfully for stream and return data which is not was not provided by a preceding call to ungetc() or ungetwc() .
getw() is not thread-safe.
|
Return val. | Next word from the input stream pointed to by stream (as an int ) |
| upon successful completion. |
EOF
| if the stream is at end-of-file. The end-of-file indicator for the stream is set;
errno is not set. |
EOF
| if a read error occurs. The error indicator for the stream is set, and errno is set to indicate the error. |
Errors | See fgetc() . |
Notes | Due to possible differences in word length and byte ordering, files written using putw() are machine-dependent, and may not be correctly read when getw() is used on a different processor. Since the representation of EOF is a valid integer, applications wishing to check for errors should use ferror() and feof() . BS2000 The following applies in the case of text files with SAM access mode and variable record length for which a maximum record length is also specified: When the specification
split=no was entered for fopen() , records of maximum length are not concatenated with the subsequent record when they are read. By default or with the specification split=yes , when a record with maximum record length is read, it is assumed that the following record is the continuation of this record and the records are concatenated (End). The program environment determines whether getw() is executed for a BS2000 or POSIX file. |
See also | ferror() , getc() , putw() , stdio.h .
|