开发者

C++ Printing Time Only to a file!

How can I pr开发者_如何学Pythonint only the current time (not the date) to a file? I need it in this format...

13:55:36

I've tried a few different ideas but they all include the date too.


Try perusing this ctime reference

A combination of using time(), localtime(), strftime(), and the struct tm should get you there


Try strftime()


Use strftime! There is a code example on that page showing how to prepare for use of this function using time(), localtime()...

char timestring[12];
strftime(timestring,sizeof(timestring),"%T",timestruct);
puts(timestring);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜