用ATL写文件
来源:互联网 发布:社交软件的普遍性 编辑:程序博客网 时间:2024/06/15 14:34
#include "stdafx.h"#include "Translate.h"#include <AtlStr.h>#include <AtlFile.h>#include <AtlTime.h>// CTranslatevoid writelogA(LPSTR s){try{USES_CONVERSION;CAtlFile oFile;CTime t = CTime::GetCurrentTime();CAtlStringA sz;sz.Format("[%d-%d-%d %d:%d:%d] %s\r\n", t.GetYear(), t.GetMonth(), t.GetDay(), t.GetHour(), t.GetMinute(), t.GetSecond(), s);CComBSTR tem(sz);if (oFile.Create(_T("C:\\log\\test.txt"), GENERIC_WRITE, FILE_SHARE_READ, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL, NULL) == S_OK){oFile.Seek(0, FILE_END);oFile.Write(tem, tem.ByteLength());oFile.Close();}}catch (...){}
}
void writelog(CString cstring)
{
LPSTR lpwlog;
lpwlog = (LPSTR)(LPCTSTR)cstring;
writelogA(lpwlog);
}
STDMETHODIMP CTranslate::Lnl_InitCommunication()
{
CString cstring("Lnl_InitCommunication");
writelog(cstring);
return S_OK;
}
0 0
- 用ATL写文件
- 用atl写的缩略图组件
- 用ATL写简单的ActiveX控件
- 用ATL写简单的ActiveX控件
- VS2008 用 ATL 写 Windows 服务
- 刚刚开始用ATL写COM组件,遇到RtlSizeHeap问题
- 使用ATL写Windows程序
- ATL写ActiveX的注意事项
- VS2008 ATL写系统服务
- VS2008 ATL写系统服务 .
- ATL中的rgs文件
- ATL CCOMPTR头文件
- 用ATL创建COM组件(详细分析了ATL创建的各种文件的意义,看完之后ATL就入门了)
- ATL中的RGS文件介绍
- ATL中的RGS文件介绍
- 关于ATL的rgs文件
- ATL中的RGS文件介绍
- COM 组件设计与应用5 - 用 ATL 写第一个组件
- 简单的存储过程
- Caffe源码中各种依赖库的作用及简单使用
- 内核error: implicit declaration of function 'irq_to_gpio' 解决方法
- 数组之—重复数字
- 《叩响C#之门》RichTextBox修改字体大小的研究
- 用ATL写文件
- memcached 使用
- hdu5492 dp
- linux查看网卡速率
- 猜错法
- 让自己的生命丰富
- kvm虚拟化学习笔记(六)之kvm虚拟机控制台登录配置
- 黑盒测试
- hdu5493 树状数组+二分