在VC里不能用gettime()函数来实现获取当前时间吗
我原来在C里面这样用的,改到VC里面,提示说要先声明
我就在前面加上了
void gettime (struct time &t1,struct time &t2);
后面是这样调用的
gettime(&t1);
.................
gettime(&t2);
错误提示为
error C2660: 'gettime' : function does not take 1 parameters
error C2660: 'gettime' : function does not take 1 parameters
是哪里错了呢?

解决方案 »

  1.   

    CTime t = CTime::GetCurrentTime();
      

  2.   

    SYSTEMTIME systemtime;
    GetLocalTime(&systemtime);
      

  3.   

    在VC里使用MFC的话,那就是楼上的方法了
      

  4.   

    有现成的API函数呀.
    在VC里使用MFC的话: CTime t = CTime::GetCurrentTime();
      

  5.   

    CTime t = CTime::GetCurrentTime();
    int i=t.GetDay();
    等函数可以获得具体的值
      

  6.   

    谢谢大家
    有没有c的方法
    在一堆c语句中插入两条c++语句行吗
      

  7.   

    如果不用MFC的话,就用这个啦,API函数
    SYSTEMTIME systemtime;
    GetLocalTime(&systemtime);