问题描述
|
嗨,
我有以下代码:
int main ()
{
time_t rawtime;
time ( &rawtime );
printf ( \"The current local time is: %s\",ctime (&rawtime) );
std::string datetoString(ctime (&rawtime) );
return 0;
}
std::string datetoString (char dat[])
//how to add ctime(&rawtime) in char dat[]?
{
std::string rez;
struct tm;
strptime(dat,\"%d %b %Y %H:%M:%S\",&tm);
// what library do i have to inclide for strptime?
rez=tm.tm_mday + \"-\" + tm.tm_mon +\"-\"+ tm.tm_year+ hour+min+sec;
//how to print the hour,minutes and secods?
return rez;
}
我在评论我的问题的地方有错误。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)