From kido@vnet.IBM.COM Mon Mar 15 03:54:05 1993 Received: from vnet.IBM.COM ([192.239.48.4]) by dkuug.dk with SMTP id AA29996 (5.65c8/IDA-1.4.4j); Mon, 15 Mar 1993 03:05:28 +0100 Message-Id: <199303150205.AA29996@dkuug.dk> Received: from YMTVM8 by vnet.IBM.COM (IBM VM SMTP V2R2) with BSMTP id 4028; Sun, 14 Mar 93 21:04:44 EST Date: Mon, 15 Mar 93 11:04:07 JST From: "Akio Kido" To: sc22wg15@dkuug.dk, sc22wg20@dkuug.dk, XoJIG@xopen.co.uk, sig-international@osf.org, uojlg-bse@uiap.ui.org, efischer@donald.aix.kingston.ibm.com Subject: MSE 4.5.3.5.mm X-Charset: ASCII X-Char-Esc: 29 .SK .H 4 "Wide character input/output functions" .H 5 "The \*(Cwfgetwc\fP function" .HU Synopsis .Cb #include #include wint_t fgetwc(FILE *stream); .Ce .HU Description .P The .Cf fgetwc function obtains the next multibyte character (if present) from the input stream pointed to by .Cf stream , converts it to a wide character, and advances the associated file position indicator for the stream (if defined). .HU Returns .P The .Cf fgetwc function returns the next wide character from the input stream pointed to by .Cf stream . If the stream is at end-of-file, the end-of-file indicator for the stream is set and .Cf fgetwc returns .Cf WEOF . If a read error occurs, the error indicator for the stream is set and .Cf fgetwc returns .Cf WEOF . If an encoding error occurs (including too few bytes), the value of the macro .Cf EILSEQ is stored in .Cf errno and .Cf fgetwc returns .Cf WEOF .\*F .FS An end-of-file and a read error can be distinguished by use of the .Cf feof and .Cf ferror functions. Also, .Cf errno will be set to .Cf EILSEQ by input/output functions only if an encoding error occurs. .FE .H 5 "The \*(Cwfgetws\fP function" .HU Synopsis .Cb #include #include wchar_t *fgetws(wchar_t *s, int n, FILE *stream); .Ce .HU Description .P The .Cf fgetws function reads at most one less than the number of wide characters specified by .Cf n from the stream pointed to by .Cf stream into the array pointed to by .Cf s . No additional wide characters are read after a new-line wide character (which is retained) or after end-of-file. A null wide character is written immediately after the last wide character read into the array. .HU Returns .P The .Cf fgetws function returns .Cf s if successful. If end-of-file is encountered and no characters have been read into the array, the contents of the array remain unchanged and a null pointer is returned. If a read or encoding error occurs during the operation, the array contents are indeterminate and a null pointer is returned. .H 5 "The \*(Cwfputwc\fP function" .HU Synopsis .Cb #include #include wint_t fputwc(wint_t c, FILE *stream); .Ce .HU Description .P The .Cf fputwc function converts the wide character specified by .Cf c to a multibyte character and writes it to the output stream pointed to by .Cf stream , at the position indicated by the associated file position indicator for the stream (if defined), and advances the indicator appropriately. If the file cannot support positioning requests, or if the stream was opened with append mode, the character is appended to the output stream. .HU Returns .P The .Cf fputwc function returns the wide character written. If a write error occurs, the error indicator for the stream is set and .Cf fputwc returns .Cf WEOF . If an encoding error occurs, the value of the macro .Cf EILSEQ is stored in .Cf errno and .Cf fputwc returns .Cf WEOF . .H 5 "The \*(Cwfputws\fP function" .HU Synopsis .Cb #include #include int fputws(const wchar_t *s, FILE *stream); .Ce .HU Description .P The .Cf fputws function converts the wide string pointed to by .Cf s into a multibyte character string and writes it to the stream pointed to by .Cf stream . The terminating null byte is not written. .HU Returns .P The .Cf fputws function returns .Cf -1 if a write or encoding error occurs; otherwise, it returns a nonnegative value. .H 5 "The \*(Cwgetwc\fP function" .HU Synopsis .Cb #include #include wint_t getwc(FILE *stream); .Ce .HU Description .P The .Cf getwc function is equivalent to .Cf fgetwc , except that if it is implemented as a macro, it may evaluate .Cf stream more than once, so the argument should never be an expression with side effects. .HU Returns .P The .Cf getwc function returns the next wide character from the input stream pointed to by .Cf stream or .Cf WEOF . .H 5 "The \*(Cwgetwchar\fP function" .HU Synopsis .Cb #include wint_t getwchar(void); .Ce .HU Description .P The .Cf getwchar function is equivalent to .Cf getwc with the argument .Cf stdin . .HU Returns .P The .Cf getwchar function returns the next wide character from the input stream pointed to by .Cf stdin or .Cf WEOF . .H 5 "The \*(Cwputwc\fP function" .HU Synopsis .Cb #include #include wint_t putwc(wint_t c, FILE *stream); .Ce .HU Description .P The .Cf putwc function is equivalent to .Cf fputwc , except that if it is implemented as a macro, it may evaluate .Cf stream more than once, so the argument should never be an expression with side effects. .HU Returns .P The .Cf putwc function returns the wide character written or .Cf WEOF . .H 5 "The \*(Cwputwchar\fP function" .HU Synopsis .Cb #include wint_t putwchar(wint_t c); .Ce .HU Description .P The .Cf putwchar function is equivalent to .Cf putwc with the second argument .Cf stdout . .HU Returns .P The .Cf putwchar function returns the character written or .Cf WEOF . .H 5 "The \*(Cwungetwc\fP function" .HU Synopsis .Cb #include #include wint_t ungetwc(wint_t c, FILE *stream); .Ce .HU Description .P The .Cf ungetwc function pushes the wide character specified by .Cf c back onto the input stream pointed to by .Cf stream . The pushed-back wide characters will be returned by subsequent reads on that stream in the reverse order of their pushing. A successful intervening call (with the stream pointed to by .Cf stream ) to a file positioning function .Cs ( fseek , .Cf fsetpos , or .Cf rewind ) discards any pushed-back wide characters for the stream. The external storage corresponding to the stream is unchanged. .P One wide character of pushback is guaranteed, even if the call to the .Cf ungetwc function follows just after a call to a formatted wide character input function .Cs ( fwscanf or .Cf wscanf ). If the .Cf ungetwc function is called too many times on the same stream without an intervening read or file positioning operation on that stream, the operation may fail. .P If the value of .Cf c equals that of the macro .Cf WEOF , the operation fails and the input stream is unchanged. .P A successful call to the .Cf ungetwc function clears the end-of-file indicator for the stream. The value of the file position indicator for the stream after reading or discarding all pushed-back wide characters shall be the same as it was before the wide characters were pushed back. For a text or binary stream, the value of its file position indicator after a successful call to the .Cf ungetwc function is unspecified until all pushed-back wide characters are read or discarded. .HU Returns .P The .Cf ungetwc function returns the wide character pushed back, or .Cf WEOF if the operation fails.