// test.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <Windows.h> #include <time.h> #include <string> int _tmain(int argc, _TCHAR* argv[]) { int size = 999999; TCHAR sCfgFile[MAX_PATH]; DWORD dw_ret = GetModuleFileName(NULL, sCfgFile, MAX_PATH); time_t start, end ; time(&start); for (int i = 0; i < size; ++i) { std::wstring path = sCfgFile; if (0 != dw_ret) { size_t pos = path.find_last_of('\'); if (-1 != pos) { path = path.substr(0, pos + 1); } } } time(&end); double cost=difftime(end,start); //wprintf(L"转化成字符串后,获取路径话费时间----%f ",cost); printf("转化成字符串后,获取路径话费时间----%f ",cost); time_t start1, end1 ; time(&start1); int i = 0; for (int j = 0; j < size; ++j) { if (dw_ret > 0) { for (i = lstrlen(sCfgFile); sCfgFile[i] != '\' && i >0; i--); sCfgFile[i + 1] = '