wcsftime


wcsftime

Generates a formatted wide string of time and date information

 #include <time.h> #include <wchar.h> size_t wcsftime ( wchar_t * restrict s , size_t n ,                  const wchar_t * restrict format ,                  const struct tm * restrict timeptr  ); 

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.

Example

 #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; 

See Also

strftime( ), setlocale( )



C(c) In a Nutshell
C in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596006977
EAN: 2147483647
Year: 2006
Pages: 473

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net