A pointer to a wide-character string, where each element is of type `wchar_t`. Used for representing text in wide-character encoding to support extended character sets.
A pointer to a read-only wide-character string, where each character is of type `wchar_t`. Used for representing text in wide-character encoding to support extended character sets, such as Unicode. The string is null-terminated, with the terminator being a `wchar_t` with value 0.
1st Parameter
Pointer to the null-terminated wide-character string containing the date and time to be parsed.
2nd Parameter Type : const wchar_t *
A pointer to a read-only wide-character string, where each character is of type `wchar_t`. Used for representing text in wide-character encoding to support extended character sets, such as Unicode. The string is null-terminated, with the terminator being a `wchar_t` with value 0.
2nd Parameter
Pointer to a null-terminated wide-character string specifying the format to interpret the input. It can include specifiers like `%Y`, `%m`, `%d`, etc.
3rd Parameter Type : struct tm *
A pointer to a `struct tm`, which represents a broken-down calendar time. The structure contains fields such as year, month, day, hour, minute, and second for representing human-readable time.
3rd Parameter
Pointer to a `struct tm` object where the parsed date and time values will be stored.
Read more about parameters of wcsptime in parameters section
The wcsptimefunction in C language Parses a wide character string representing a time according to a format string and stores the information in a structure.
wcsptime converts the wide character string pointed to by buf to values which are stored in the tm structure pointed to by tm, using the format specified by format. It is the wide-character counterpart of strptime.
The wcsptimefunction takes 3
parameters:
•
const wchar_t * `ws`: Pointer to the null-terminated wide-character string containing the date and time to be parsed.
•
const wchar_t * `format`: Pointer to a null-terminated wide-character string specifying the format to interpret the input. It can include specifiers like `%Y`, `%m`, `%d`, etc.
•
struct tm * `timeptr`: Pointer to a `struct tm` object where the parsed date and time values will be stored.
Parses the wide-character string `ws` according to the format specified by `format` and stores the resulting date and time values in the `struct tm` object pointed to by `timeptr`. Returns a pointer to the first wide character not processed in `ws`, or `NULL` if an error occurs or if the input does not match the format.
The wcsptime function return value :
Returns a pointer to the first wide character following the last parsed character in buf
If the parse fails, a null pointer is returned
Output
This example demonstrates the basic usage of wcsptime to parse a date and time string into a struct tm.