从哪天哪时开始?
解决方案 »
- CreateRemoteThread注入DLL的问题
- Smart PropertyGrid 使用的方法
- VC缺陷》?
- Re:CreateProcess的有关问题
- 我在资源里添加菜单后,编辑File->Exit.然后添加这些代码,可是运行Exit时候却是灰色不可用?
- 高手救命,串口CMSCOmm控件问题
- 请问在vc中如何通过程序将一幅图片插入到一个word文当中的某一行后面去。高手请进
- :)各位大虾,我现在想做一个聊天室(多线程或者异步的),谁有好的例子,可以给我一个吗?谢谢了,:)mail:[email protected]
- 请问如何把int转换成cstring?
- VC技术内幕
- bitmap的显示问题!
- 如何使closesocket断开后不出现time_out连接??(请高手回答,谢谢)
#include <time.h>
#include <stdio.h>void main( void )
{
struct tm when;
time_t now, result;
int days; time( &now );
when = *localtime( &now );
printf( "Current time is %s\n", asctime( &when ) );
printf( "How many days to look ahead: " );
scanf( "%d", &days ); when.tm_mday = when.tm_mday + days;
if( (result = mktime( &when )) != (time_t)-1 )
printf( "In %d days the time will be %s\n",
days, asctime( &when ) );
else
perror( "mktime failed" );
}
OutputCurrent time is Tue May 03 12:45:47 1994How many days to look ahead: 29
In 29 days the time will be Wed Jun 01 12:45:47 1994
The time function returns the number of seconds elapsed since midnight (00:00:00), January 1, 1970