This function closes an open object handle.
BOOL CloseHandle( HANDLE hObject )
TRUE for success
EX1
int CloseHandle_ex1() { char* szFilename = "c:\\test.txt" ; BOOL bRet = FALSE; HANDLE hFile = CreateFile(szFilename, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile != INVALID_HANDLE_VALUE) { //do something... CloseHandle(hFile); } return 1; }
CreateFile
origin.h