getw()

get word from stream 

Function


SYNOPSIS

#include <stdio.h>

int getw(FILE *stream);


DESCRIPTION

The getw() function obtains the next binary integer (if present) from the input stream pointed to by stream, and then advances the associated file position indicator for the stream (if defined).

The function getw() assumes no special alignment in the input file. Because the size and byte ordering of integers varies from one machine to another, getw() is not recommended for portable applications.


PARAMETERS

stream 

Points to the input stream.


RETURN VALUES

The getw() function returns the next integer from the input stream pointed to by stream. If the stream is at the end of the file or has fewer characters available than the length of an integer, the end-of-file indicator for the stream is set and getw() returns EOF. If a read error occurs, the error indicator for the stream is set and getw() returns EOF. Because EOF is a valid integer value, feof() and ferror() rather than the return value should be used to check for end-of-file or read errors.

On failure, errno is set to one of the following values:

EACCES 

Another process has the file locked.

EBADF 

stream is not a valid stream opened for reading.

EINTR 

A signal interrupted the call.

EIO 

An input error occurred.

EISDIR 

The open object is a directory, rather than a file.

ENOMEM 

Memory could not be allocated for internal buffers.

ENXIO 

A device error occurred.

EOVERFLOW 

The file is a regular file and an attempt was made to read at or beyond the offset maximum associated with the corresponding stream.

EWOULDBLOCK 

The underlying file descriptor is a non-blocking socket and no data is ready to be read.


CONFORMANCE

UNIX 98, with exceptions.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

If the stream is from a file opened in text mode, the line-terminating character sequence carriage return plus linefeed is translated to linefeed, even though getw() performs a binary read. No such translation occurs for files opened in binary mode.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
feof(), ferror(), fread(), getc()


PTC MKS Toolkit 10.3 Documentation Build 39.