struct tm *TimeBegin=NULL;
TimeBegin->tm_year=2005;
TimeBegin->tm_mon=1;
TimeBegin->tm_mday=1;
TimeBegin->tm_hour=0;
TimeBegin->tm_min=0;
TimeBegin->tm_sec=0;
我这么直接赋值不行,出错,请问应该怎么赋值呢,谢谢
TimeBegin->tm_year=2005;
TimeBegin->tm_mon=1;
TimeBegin->tm_mday=1;
TimeBegin->tm_hour=0;
TimeBegin->tm_min=0;
TimeBegin->tm_sec=0;
我这么直接赋值不行,出错,请问应该怎么赋值呢,谢谢
解决方案 »
- cin 如何可以输入换行符呢? char ch; cin >> ch; 用以上代码是无法输入空格和换行符的(这是书上讲的,我试过,会忽略空格,但是换行符我不知如
- msword组件开发不弹出窗口的问题
- 求助关于数据更替的问题
- 求助ActiveX!
- com技术内幕书中附的源码中的组件(dll)是如何编译得到的?
- 如何区分中英字符??
- html help workshop中图片的编辑问题
- 两个类定义中相互引用对方无法通过编译
- 对话框回车关闭的问题
- setdefaultitem
- 向高手请教有关邮件显示控件的问题!!!!~~~
- 紧急求助:用MSChart画曲线,曲线以生成,但在图上怎么用鼠标改以生成的曲线?MSChart支持吗?若不支持有别的控件吗?解决立即结帖,谢谢!
/* The example takes a number of days
* as input and returns the time, the current
* date, and the specified number of days.
*/#include <time.h>
#include <stdio.h>int main( void )
{
struct tm when;
__time64_t now, result;
int days; _time64( &now );
when = *_localtime64( &now );
printf( "Current time is %s\n", asctime( &when ) );
days = 20;
when.tm_mday = when.tm_mday + days;
if( (result = _mktime64( &when )) != (time_t)-1 )
printf( "In %d days the time will be %s\n",
days, asctime( &when ) );
else
perror( "_mktime64 failed" );
}