December 2005
Beginner to intermediate
618 pages
20h 19m
English
wcsftime
Generates a formatted wide string of time and date information
#include <time.h> #include <wchar.h> size_twcsftime( wchar_t * restricts, size_tn, const wchar_t * restrictformat, const struct tm * restricttimeptr);
The wcsftime() function is
similar to strftime(), except
that its format string argument and the output string it generates
are wide character strings. Accordingly, the length
n and the function’s return value
indicate numbers of wide characters, not byte characters. The
locations that wcsftime() reads
from and writes to using its restricted pointer parameters must not
overlap.
#define MAX_HDR 1024
time_t now;
struct tm *localnow;
wchar_t hdr_date[MAX_HDR] = L"";
time( &now );
localnow = localtime( &now );
if (wcsftime( hdr_date, MAX_HDR, L"Date: %a, %d %b %Y %T %z", localnow ) )
fputws( hdr_date, stdout );
else
return -1;Read now
Unlock full access