Unleashed v1.4
[unleashed.git] / share / man / man3c / iconv_open.3c
blob37d4c3bdfa5c7fc876f4ec1fd904950410d141bc
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
44 .\" Portions Copyright (c) 2001, Sun Microsystems, Inc.  All Rights Reserved
45 .\"
46 .TH ICONV_OPEN 3C "Oct 2, 2001"
47 .SH NAME
48 iconv_open \- code conversion allocation function
49 .SH SYNOPSIS
50 .LP
51 .nf
52 #include <iconv.h>
54 \fBiconv_t\fR \fBiconv_open\fR(\fBconst char *\fR\fItocode\fR, \fBconst char *\fR\fIfromcode\fR);
55 .fi
57 .SH DESCRIPTION
58 .sp
59 .LP
60 The \fBiconv_open()\fR function returns a conversion descriptor that describes
61 a conversion from the codeset specified by the string pointed to by the
62 \fIfromcode\fR argument to the codeset specified by the string pointed to by
63 the \fItocode\fR argument. For state-dependent encodings, the conversion
64 descriptor will be in  a codeset-dependent initial shift state, ready for
65 immediate use with the  \fBiconv\fR(3C) function.
66 .sp
67 .LP
68 Settings of \fIfromcode\fR and \fItocode\fR and their permitted combinations
69 are implementation-dependent.
70 .sp
71 .LP
72 The \fBiconv_open()\fR function supports the alias of the encoding name
73 specified in \fItocode\fR and \fIfromcode\fR.  The alias table of the encoding
74 name is described in the file \fB/usr/lib/iconv/alias\fR. See \fBalias\fR(4).
75 .sp
76 .LP
77 A conversion descriptor remains valid in a process until that process closes
78 it.
79 .sp
80 .LP
81 For examples using the  \fBiconv_open()\fR function, see \fBiconv\fR(3C).
82 .SH RETURN VALUES
83 .sp
84 .LP
85 Upon successful completion  \fBiconv_open()\fR returns a conversion descriptor
86 for use on subsequent calls to  \fBiconv()\fR. Otherwise, \fBiconv_open()\fR
87 returns \fB(iconv_t)\fR \fB\(mi1\fR and sets \fBerrno\fR to indicate the error.
88 .SH ERRORS
89 .sp
90 .LP
91 The  \fBiconv_open\fR function may fail if:
92 .sp
93 .ne 2
94 .na
95 \fB\fBEMFILE\fR\fR
96 .ad
97 .RS 10n
98 \fB{OPEN_MAX}\fR files descriptors are currently open in the calling process.
99 .RE
102 .ne 2
104 \fB\fBENFILE\fR\fR
106 .RS 10n
107 Too many files are currently open in the system.
111 .ne 2
113 \fB\fBENOMEM\fR\fR
115 .RS 10n
116 Insufficient storage space is available.
120 .ne 2
122 \fB\fBEINVAL\fR\fR
124 .RS 10n
125 The conversion specified by \fIfromcode\fR and \fItocode\fR is not supported by
126 the implementation.
129 .SH FILES
131 .ne 2
133 \fB\fB/usr/lib/iconv/alias\fR\fR
135 .RS 24n
136 alias table file of the encoding name
139 .SH ATTRIBUTES
142 See \fBattributes\fR(5) for descriptions of the following attributes:
147 box;
148 c | c
149 l | l .
150 ATTRIBUTE TYPE  ATTRIBUTE VALUE
152 Interface Stability     Standard
154 MT-Level        MT-Safe
157 .SH SEE ALSO
160 \fBexec\fR(2), \fBiconv\fR(3C), \fBiconv_close\fR(3C), \fBmalloc\fR(3C),
161 \fBalias\fR(4), \fBattributes\fR(5)
162 .SH NOTES
165 The \fBiconv_open()\fR function uses \fBmalloc\fR(3C) to allocate space for
166 internal buffer areas. \fBiconv_open()\fR may fail if there is insufficient
167 storage space to accommodate these buffers.
170 Portable applications must assume that conversion descriptors are not valid
171 after a call to one of the \fBexec\fR functions (see \fBexec\fR(2)).