您的位置:首页 > 其它

开始学习windows api了,写个hello,world纪念一下

2010-06-28 17:00 429 查看
代码#include <windows.h>
#include <tchar.h>
int _tmain(int argc,LPTSTR argv[])
{
HANDLE hFile = CreateFile(TEXT("d:\\test.txt"),
GENERIC_WRITE,0,NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,NULL);

if(hFile != INVALID_HANDLE_VALUE)
{
DWORD writeBytes = 0;
PTSTR text = TEXT("hello,world");
DWORD len = strlen(text);
WriteFile(hFile,text,len,&writeBytes,NULL);
CloseHandle(hFile);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: