15,473
社区成员




void __cdecl __crtExitProcess (
int status
)
{
__crtCorExitProcess(status);
/*
* Either mscoree.dll isn't loaded,
* or CorExitProcess isn't exported from mscoree.dll,
* or CorExitProcess returned (should never happen).
* Just call ExitProcess.
*/
ExitProcess(status);
}
经查是全局变量释放问题,然后逐个排查发现一个取得时间设置时间的函数注视掉就没问题
#include "stdafx.h"
#include "time.h"
#include "vld.h"
void setTime()
{
time_t T;
struct tm *TimeP1=new struct tm;
T = time(NULL);
localtime_s(TimeP1, &T );
delete TimeP1;
}
int _tmain(int argc, _TCHAR* argv[])
{
setTime();
return 0;
}
// MSDN的例子程序,不妨参考一下
// crt_localtime.cpp
// compile with: /W3
/* This program uses _time64 to get the current time
* and then uses localtime64() to convert this time to a structure
* representing the local time. The program converts the result
* from a 24-hour clock to a 12-hour clock and determines the
* proper extension (AM or PM).
*/
#include <stdio.h>
#include <string.h>
#include <time.h>
int main( void )
{
struct tm *newtime;
char am_pm[] = "AM";
__time64_t long_time;
_time64( &long_time ); // Get time as 64-bit integer.
// Convert to local time.
newtime = _localtime64( &long_time ); // C4996
// Note: _localtime64 deprecated; consider _localetime64_s
if( newtime->tm_hour > 12 ) // Set up extension.
strcpy_s( am_pm, sizeof(am_pm), "PM" );
if( newtime->tm_hour > 12 ) // Convert from 24-hour
newtime->tm_hour -= 12; // to 12-hour clock.
if( newtime->tm_hour == 0 ) // Set hour to 12 if midnight.
newtime->tm_hour = 12;
char buff[30];
asctime_s( buff, sizeof(buff), newtime );
printf( "%.19s %s\n", buff, am_pm );
}