1iconv_open(3C) Standard C Library Functions iconv_open(3C)
2
3
4
6 iconv_open - code conversion allocation function
7
9 #include <iconv.h>
10
11 iconv_t iconv_open(const char *tocode, const char *fromcode);
12
13
15 The iconv_open() function returns a conversion descriptor that
16 describes a conversion from the codeset specified by the string pointed
17 to by the fromcode argument to the codeset specified by the string
18 pointed to by the tocode argument. For state-dependent encodings, the
19 conversion descriptor will be in a codeset-dependent initial shift
20 state, ready for immediate use with the iconv(3C) function.
21
22
23 Settings of fromcode and tocode and their permitted combinations are
24 implementation-dependent.
25
26
27 The iconv_open() function supports the alias of the encoding name spec‐
28 ified in tocode and fromcode. The alias table of the encoding name is
29 described in the file /usr/lib/iconv/alias. See alias(4).
30
31
32 A conversion descriptor remains valid in a process until that process
33 closes it.
34
35
36 For examples using the iconv_open() function, see iconv(3C).
37
39 Upon successful completion iconv_open() returns a conversion descrip‐
40 tor for use on subsequent calls to iconv(). Otherwise, iconv_open()
41 returns (iconv_t) −1 and sets errno to indicate the error.
42
44 The iconv_open function may fail if:
45
46 EMFILE {OPEN_MAX} files descriptors are currently open in the call‐
47 ing process.
48
49
50 ENFILE Too many files are currently open in the system.
51
52
53 ENOMEM Insufficient storage space is available.
54
55
56 EINVAL The conversion specified by fromcode and tocode is not sup‐
57 ported by the implementation.
58
59
61 /usr/lib/iconv/alias alias table file of the encoding name
62
63
65 See attributes(5) for descriptions of the following attributes:
66
67
68
69
70 ┌─────────────────────────────┬─────────────────────────────┐
71 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
72 ├─────────────────────────────┼─────────────────────────────┤
73 │Interface Stability │Standard │
74 ├─────────────────────────────┼─────────────────────────────┤
75 │MT-Level │MT-Safe │
76 └─────────────────────────────┴─────────────────────────────┘
77
79 exec(2), iconv(3C), iconv_close(3C), malloc(3C), alias(4),
80 attributes(5)
81
83 The iconv_open() function uses malloc(3C) to allocate space for inter‐
84 nal buffer areas. iconv_open() may fail if there is insufficient stor‐
85 age space to accommodate these buffers.
86
87
88 Portable applications must assume that conversion descriptors are not
89 valid after a call to one of the exec functions (see exec(2)).
90
91
92
93SunOS 5.11 2 Oct 2001 iconv_open(3C)