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

代码
#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);
    }
}


你可能感兴趣的:(windows)