幽幽
 
posts - 51,  comments - 28,  trackbacks - 0

1 将Cstring转成TCHAR*

StrToTchar(CString temString,TCHAR * pTchar)
{
int tmpLength=0 ;
tmpLength = temString.GetLength();
TCHAR * ptemTchar = temString.GetBuffer(tmpLength);
wcscpy( pTchar,ptemTchar);
}

2 获取系统时间

CString GetSysTime()
{//得到系统时间
CString strTime;
SYSTEMTIME st;
::GetLocalTime(&st);
TCHAR datetime[20];
TCHAR times[20];
GetDateFormat(LOCALE_USER_DEFAULT,NULL,&st,_T("yyyy-MM-dd"),datetime,20);
GetTimeFormat(LOCALE_USER_DEFAULT,NULL,&st,_T("HH:mm:ss"),times,20);
strTime = (CString)datetime + _T(" ")+(CString)times;
return strTime;
}

 

CTime t = CTime::GetCurrentTime();
SelfInfo[8] = IntToStr(t.GetYear());
SelfInfo[9] = IntToStr(t.GetMonth());
SelfInfo[10] = IntToStr(t.GetDay());

 

3 写日志


void Writelog(char *str)
{
FILE *fp;
fp = fopen("\\Storage\\LogFile.txt","w+");
if(!fp)
{
   return;
}
fprintf(fp,"%s\n",str);
fclose(fp);
return;
}


posted on 2008-06-23 03:59 幽幽 阅读(306) 评论(0)  编辑 收藏 引用 所属分类: 杂集

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理



<2008年6月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

常用链接

留言簿(5)

随笔分类(35)

随笔档案(51)

文章分类(3)

文章档案(3)

相册

我的链接

搜索

  •  

最新评论

阅读排行榜

评论排行榜