strptime() equivalent on Windows?(strptime() 在 Windows 上等价?)
问题描述
是否有适用于 Windows 的 strptime() 的等效实现?不幸的是,这个 POSIX 函数似乎不可用.
Is there a good equivalent implementation of strptime() available for Windows? Unfortunately, this POSIX function does not appear to be available.
strptime 的开放组描述 - 总结:它转换文本将"MM-DD-YYYY HH:MM:SS"等字符串转化为tm struct,与strftime()相反.>
Open Group description of strptime - summary: it converts a text string such as "MM-DD-YYYY HH:MM:SS" into a tm struct, the opposite of strftime().
推荐答案
strptime() 的开源版本(BSD 许可)可以在这里找到:http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/time/strptime.c?rev=HEAD
An open-source version (BSD license) of strptime() can be found here: http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/time/strptime.c?rev=HEAD
您需要添加以下声明才能使用它:
You'll need to add the following declaration to use it:
char *strptime(const char * __restrict, const char * __restrict, struct tm * __restrict);
这篇关于strptime() 在 Windows 上等价?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:strptime() 在 Windows 上等价?
基础教程推荐
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 常量变量在标题中不起作用 2021-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 这个宏可以转换成函数吗? 2022-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
