|
|
Several of the I/O functions described in Chapter 6 have wide-character implementations. These functions are shown in the following table. The wide-character I/O functions use the header <wchar.h>. Notice that swprintf( ) and vswprintf( ) require an additional parameter not needed by their char equivalents.
Function | char Equivalent |
---|---|
win_t fgetwc(FILE *stream) | fgetc( ) |
wchar_t *fgetws(wchar_t *str, int num, | fgets( ) |
wint_t fputwc(wchar_t ch, FILE *stream) | fputc( ) |
int fputws(const wchar_t *str, | fputs( ) |
int fwprintf(FILE *stream, | fprintf( ) |
int fwscanf(FILE *stream, | fscanf( ) |
wint_t getwc(FILE *stream) | getc( ) |
wint_t getwchar(void) | getchar( ) |
wint_t putwc(wchar_t ch, FILE *stream) | putc( ) |
wint_t putwchar(wchar_t ch) | putchar( ) |
int swprintf(wchar_t *str, size_t num, | sprintf( ) |
int swscanf(const wchar_t *str, | sscanf( ) |
wint_t ungetwc(wint_t ch, FILE *stream) | ungetc( ) |
int vfwprintf(FILE *stream, | vfprintf( ) |
int vfwscanf(FILE * restrict stream, | vfscanf( ) (Added by C99.) |
int vswprintf(wchar_t *str, size_t num, | vsprintf( ) |
int vswscanf(const wchar_t * restrict str, | vsscanf( ) (Added by C99.) |
int vwprintf(const wchar_t | vprintf( ) |
int vwscanf(const wchar_t * restrict fmt, | vscanf( ) (Added by C99.) |
int wprintf(const wchar_t *fmt, ...) | printf( ) |
int wscanf(const wchar_t *fmt, ...) | scanf( ) |
In addition to those shown in the table, the following wide-character I/O function has been added:
int fwide(FILE *stream, int how);
If how is positive, fwide( ) makes stream a wide-character stream. If how is negative, fwide( ) makes stream into a char stream. If how is zero, stream is unaffected. If the stream has already been oriented to either wide or normal characters, it will not be changed. The function returns positive if the stream uses wide characters, negative if the stream uses chars, and zero if the stream has not yet been oriented. A stream’s orientation is also determined by its first use.
|
|