United States-English |
|
|
HP-UX Reference > Ggetwc(3C)HP-UX 11i Version 3: February 2007 |
|
NAMEgetwc(), 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 Interfaceswint_t getwc_unlocked(FILE *stream); wint_t getwchar_unlocked(void); wint_t fgetwc_unlocked(FILE *stream); RemarksThese 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
Definitions for these functions, the types wint_t, wchar_t and the value WEOF are provided in header file <wchar.h>. APPLICATION USAGEAfter getwc(), getwchar(), or fgetwc() is applied to a stream, the stream becomes wide-oriented (see orientation(5)). RETURN VALUEUpon 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. When the file corresponding to an open stream gets extended after the end-of-file is reached, any subsequent calls to these functions will succeed and the end-of-file indicator will remain set. However, in the UNIX2003 standards environment (see standards(5)), these functions will return WEOF and the end-of-file indicator will still remain set. If a read error occurs, the error indicator 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 condition. ERRORSgetwc(), getwc_unlocked(), getwchar(), getwchar_unlocked(), fgetwc(), and fgetwc_unlocked() fail if data needs to be read into the stream's buffer, and:
Additional errno values may be set by the underlying read() function (see read(2)). WARNINGSIf the value returned by getwc(), getwchar(), fgetwc(), or fgetwc_unlocked() is stored into a type wchar_t variable then compared against the constant WEOF, the comparison may never succeed because extension of a wchar_t to a wint_t is machine-dependent. getwc_unlocked(), getwchar_unlocked() and fgetwc_unlocked() are obsolescent interfaces supported only for compatibility with existing DCE applications. New multithreaded applications should use getwc(), getwchar() and fgetwc(). |
Printable version | ||
|