Merge from vendor branch OPENSSL:
[dragonfly.git] / lib / libc / stdio / getwc.3
1 .\"     $NetBSD: getwc.3,v 1.7 2003/09/08 17:54:32 wiz Exp $
2 .\"     $DragonFly: src/lib/libc/stdio/getwc.3,v 1.1 2005/07/25 00:37:41 joerg Exp $
3 .\"
4 .\" Copyright (c) 1990, 1991, 1993
5 .\"     The Regents of the University of California.  All rights reserved.
6 .\"
7 .\" This code is derived from software contributed to Berkeley by
8 .\" Chris Torek and the American National Standards Committee X3,
9 .\" on Information Processing Systems.
10 .\"
11 .\" Redistribution and use in source and binary forms, with or without
12 .\" modification, are permitted provided that the following conditions
13 .\" are met:
14 .\" 1. Redistributions of source code must retain the above copyright
15 .\"    notice, this list of conditions and the following disclaimer.
16 .\" 2. Redistributions in binary form must reproduce the above copyright
17 .\"    notice, this list of conditions and the following disclaimer in the
18 .\"    documentation and/or other materials provided with the distribution.
19 .\" 3. Neither the name of the University nor the names of its contributors
20 .\"    may be used to endorse or promote products derived from this software
21 .\"    without specific prior written permission.
22 .\"
23 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" SUCH DAMAGE.
34 .\"
35 .\"     @(#)getc.3      8.1 (Berkeley) 6/4/93
36 .\"
37 .Dd October 24, 2001
38 .Dt GETWC 3
39 .Os
40 .Sh NAME
41 .Nm fgetwc ,
42 .Nm getwc ,
43 .Nm getwchar ,
44 .Nd get next wide-character from input stream
45 .Sh LIBRARY
46 .Lb libc
47 .Sh SYNOPSIS
48 .In stdio.h
49 .In wchar.h
50 .Ft wint_t
51 .Fn fgetwc "FILE *stream"
52 .Ft wint_t
53 .Fn getwc "FILE *stream"
54 .Ft wint_t
55 .Fn getwchar
56 .Sh DESCRIPTION
57 The
58 .Fn fgetwc
59 function
60 obtains the next input wide-character (if present) from the stream pointed at by
61 .Fa stream ,
62 or the next character pushed back on the stream via
63 .Xr ungetwc 3 .
64 .Pp
65 The
66 .Fn getwc
67 function
68 acts essentially identically to
69 .Fn fgetwc ,
70 but is a macro that expands in-line.
71 .Pp
72 The
73 .Fn getwchar
74 function
75 is equivalent to
76 .Fn getwc
77 with the argument stdin.
78 .Sh RETURN VALUES
79 If successful, these routines return the next wide-character
80 from the
81 .Fa stream .
82 If the stream is at end-of-file or a read error occurs,
83 the routines return
84 .Dv WEOF .
85 The routines
86 .Xr feof 3
87 and
88 .Xr ferror 3
89 must be used to distinguish between end-of-file and error.
90 If an error occurs, the global variable
91 .Va errno
92 is set to indicate the error.
93 The end-of-file condition is remembered, even on a terminal, and all
94 subsequent attempts to read will return
95 .Dv WEOF
96 until the condition is cleared with
97 .Xr clearerr 3 .
98 .Sh SEE ALSO
99 .Xr ferror 3 ,
100 .Xr fopen 3 ,
101 .Xr fread 3 ,
102 .Xr putwc 3 ,
103 .Xr stdio 3 ,
104 .Xr ungetwc 3
105 .Sh STANDARDS
106 The
107 .Fn fgetwc ,
108 .Fn getwc
109 and
110 .Fn getwchar
111 functions
112 conform to
113 .St -isoC-99 .