小寒的blog
Programming is a darned hard thing—but I am going to like it.
代码
#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);
    }
}


posted on 2010-06-28 17:00  xhan  阅读(429)  评论(0编辑  收藏  举报