Now in the company overtime, but, do not like the current job, want to go to change to C #, but the foundation is too weak, in hard study. Come on
Comment on this code another day, then go to move (Jia) Brick (ban) go ...
1#include <windows.h>2 /*3 Get System infomation and Copy to a File4 */5 intMainintargc, TCHAR argv [])6 {7 //File Handle8 HANDLE hfile;9 DWORD Dwwritten;Ten //Char Array to Store the Path of the System infomation One TCHAR Szsystemdir [MAX_PATH]; A //Get System Directory - getsystemdirectory (Szsystemdir, MAX_PATH); - the //creat File SystemRoot.txt -hfile =CreateFile ( - "SystemRoot.txt", - Generic_write, + 0, Null,create_always, - File_attribute_normal, + NULL A ); at if(hfile! =Invalid_handle_value) - { - //Write the System infomation to the File SystemRoot.txt - if(! WriteFile (hfile, Szsystemdir, Lstrlen (Szsystemdir), &dwwritten, NULL)); - { - returnGetLastError (); in } - } to //Close the File + CloseHandle (hfile); - return 0; the}
View Code
Windows API Programming the next day 2015.11.15