HP-UX Reference (11i v1 00/12) - 3 Library Functions A-M (vol 6)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/!!!intro.3c
________________________________________________________________
___ ___
g
getwc(3C) getwc(3C)
NAME
getwc(), getwchar(), fgetwc() - get a wide character from a stream file
SYNOPSIS
#include <wchar.h>
wint_t getwc(FILE *stream);
wint_t getwchar(void);
wint_t fgetwc(FILE *stream);
Obsolescent Interfaces
wint_t getwc_unlocked(FILE *stream);
wint_t getwchar_unlocked(void);
wint_t fgetwc_unlocked(FILE *stream);
Remarks:
These functions are compliant with the XPG4 Worldwide Portability Interface wide-character I/O
functions. They parallel the 8 bit character I/O functions defined in getc(3S).
DESCRIPTION
getwc() Returns the next character from the named input stream, converts that to the correspond-
ing wide character and moves the file pointer ahead one character in stream.
getwchar() is defined as getwc(stdin) . getwc() and getwchar() are defined
both as macros and as functions.
fgetwc() Behaves like getwc(), but is a function rather than a macro.
Definitions for these functions, the types wint_t, wchar_t and the value WEOF are provided in header
file <
wchar.h>.
Obsolescent Interfaces
getwc_unlocked(), getwchar_unlocked()
, fgetwc_unlocked()
get a wide character from
a stream file.
APPLICATION USAGE
getwc(), getwchar() and fgetwc() are thread-safe. These interfaces are not async-cancel-safe. A
cancellation point may occur when a thread is executing these interfaces.
After getwc(), getwchar(),orfgetwc() is applied to a stream, the stream becomes wide-oriented
(see orientation(5)).
RETURN VALUE
Upon successful completion, getwc(), getwc_unlocked(), getwchar() ,
getwchar_unlocked(), fgetwc(), and fgetwc_unlocked() return the next wide character
read from stream (stdin for getwchar() ) converted to a type wint_t. If the stream is at end-of-file,
the end-of-file indicator for the stream is set and WEOF is returned. If a read error occurs, the error indica-
tor for the stream is set, errno is set to indicate the error, and WEOF is returned.
ferror() and feof() can be used to distinguish between an error condition and an end-of-file condi-
tion.
ERRORS
getwc(), getwc_unlocked(), getwchar() , getwchar_unlocked()
, fgetwc(), and
fgetwc_unlocked() fail if data needs to be read into the stream’s buffer, and:
[EAGAIN] The
O_NONBLOCK flag is set for the file descriptor underlying stream and the process
would be delayed in the read operation.
[EBADF] The file descriptor underlying stream is not a valid file descriptor open for reading.
[EINTR] The read operation was terminated due to the receipt of a signal, and either no data
was transferred or the implementation does not report partial transfer for this file.
[EIO] A physical I/O error has occurred, or the process is a member of a background process
and is attempting to read from its controlling terminal, and either the process is
HP-UX Release 11i: December 2000 − 1 − Section 3−−369
___
___