Penguin
Annotated edit history of wcrtomb(3) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 WCRTOMB
2 !!!WCRTOMB
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 RETURN VALUE
7 CONFORMING TO
8 SEE ALSO
9 NOTES
10 ----
11 !!NAME
12
13
14 wcrtomb - convert a wide character to a multibyte sequence
15 !!SYNOPSIS
16
17
18 __#include
19 __''s''__, wchar_t__ ''wc''__, mbstate_t *__''ps''__);
20 __
21 !!DESCRIPTION
22
23
24 The main case for this function is when ''s'' is not NULL
25 and ''wc'' is not L'0'. In this case, the __wcrtomb__
26 function converts the wide character ''wc'' to its
27 multibyte representation and stores it at the beginning of
28 the character array pointed to by ''s''. It updates the
29 shift state ''*ps'', and returns the length of said
30 multibyte representation, i.e. the number of bytes written
31 at ''s''.
32
33
34 A different case is when ''s'' is not NULL but ''wc''
35 is L'0'. In this case the __wcrtomb__ function stores at
36 the character array pointed to by ''s'' the shift
37 sequence needed to bring ''*ps'' back to the initial
38 state, followed by a '0' byte. It updates the shift state
39 ''*ps'' (i.e. brings it into the initial state), and
40 returns the length of the shift sequence plus one, i.e. the
41 number of bytes written at ''s''.
42
43
44 A third case is when ''s'' is NULL. In this case
45 ''wc'' is ignored, and the function effectively returns
46 wcrtomb(buf,L'0',''ps'') where buf is an internal
47 anonymous buffer.
48
49
50 In all of the above cases, if ''ps'' is a NULL pointer, a
51 static anonymous state only known to the wcrtomb function is
52 used instead.
53 !!RETURN VALUE
54
55
56 The __wcrtomb__ function returns the number of bytes that
57 have been or would have been written to the byte array at
58 ''s''. If ''wc'' can not be represented as a multibyte
59 sequence (according to the current locale), (size_t)(-1) is
60 returned, and __errno__ set to
61 __EILSEQ__.
62 !!CONFORMING TO
63
64
65 ISO/ANSI C, UNIX98
66 !!SEE ALSO
67
68
69 wcsrtombs(3)
70 !!NOTES
71
72
73 The behaviour of __wcrtomb__ depends on the LC_CTYPE
74 category of the current locale.
75
76
77 Passing NULL as ''ps'' is not multi-thread
78 safe.
79 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.