1<html lang="en"> 2<head> 3<title>wcsftime - Untitled</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Untitled"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Wchar-strings.html#Wchar-strings" title="Wchar strings"> 9<link rel="prev" href="wcscspn.html#wcscspn" title="wcscspn"> 10<link rel="next" href="wcslcat.html#wcslcat" title="wcslcat"> 11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 12<meta http-equiv="Content-Style-Type" content="text/css"> 13<style type="text/css"><!-- 14 pre.display { font-family:inherit } 15 pre.format { font-family:inherit } 16 pre.smalldisplay { font-family:inherit; font-size:smaller } 17 pre.smallformat { font-family:inherit; font-size:smaller } 18 pre.smallexample { font-size:smaller } 19 pre.smalllisp { font-size:smaller } 20 span.sc { font-variant:small-caps } 21 span.roman { font-family:serif; font-weight:normal; } 22 span.sansserif { font-family:sans-serif; font-weight:normal; } 23--></style> 24<link rel="stylesheet" type="text/css" href="../cs.css"> 25</head> 26<body> 27<div class="node"> 28<a name="wcsftime"></a> 29<p> 30Next: <a rel="next" accesskey="n" href="wcslcat.html#wcslcat">wcslcat</a>, 31Previous: <a rel="previous" accesskey="p" href="wcscspn.html#wcscspn">wcscspn</a>, 32Up: <a rel="up" accesskey="u" href="Wchar-strings.html#Wchar-strings">Wchar strings</a> 33<hr> 34</div> 35 36<h3 class="section">6.13 <code>wcsftime</code>–convert date and time to a formatted wide-character string</h3> 37 38<p><a name="index-wcsftime-417"></a><strong>Synopsis</strong> 39<pre class="example"> #include <time.h> 40 #include <wchar.h> 41 size_t wcsftime(wchar_t *<var>s</var>, size_t <var>maxsize</var>, 42 const wchar_t *<var>format</var>, const struct tm *<var>timp</var>); 43 44</pre> 45 <p><strong>Description</strong><br> 46<code>wcsftime</code> is equivalent to <code>strftime</code>, except that: 47 <ul> 48<li>The argument s points to the initial element of an array of wide characters 49into which the generated output is to be placed. 50<li>The argument maxsize indicates the limiting number of wide characters. 51<li>The argument format is a wide-character string and the conversion specifiers 52are replaced by corresponding sequences of wide characters. 53<li>The return value indicates the number of wide characters. 54</ul> 55 56 <p>(The difference in all of the above being wide characters versus regular 57characters.) 58See <code>strftime</code> for the details of the format specifiers. 59 60 <p><br> 61<strong>Returns</strong><br> 62When the formatted time takes up no more than <var>maxsize</var> wide characters, 63the result is the length of the formatted wide string. Otherwise, if the 64formatting operation was abandoned due to lack of room, the result is 65<code>0</code>, and the wide-character string starting at <var>s</var> corresponds to just those 66parts of <code>*</code><var>format</var> that could be completely filled in within the 67<var>maxsize</var> limit. 68 69 <p><br> 70<strong>Portability</strong><br> 71C99 and POSIX require <code>wcsftime</code>, but do not specify the contents of 72<code>*</code><var>s</var> when the formatted string would require more than 73<var>maxsize</var> characters. Unrecognized specifiers and fields of 74<code>timp</code> that are out of range cause undefined results. Since some 75formats expand to 0 bytes, it is wise to set <code>*</code><var>s</var> to a nonzero 76value beforehand to distinguish between failure and an empty string. 77This implementation does not support <code>s</code> being NULL, nor overlapping 78<code>s</code> and <code>format</code>. 79 80 <p><code>wcsftime</code> requires no supporting OS subroutines. 81 82 <p><br> 83<strong>See Also</strong><br> 84<code>strftime</code> 85 86 <p><br> 87 88 </body></html> 89 90