hFile = CreateFile("MYFILE.TXT", // open MYFILE.TXT GENERIC_READ, // open for reading FILE_SHARE_READ, // share for reading NULL, // no security OPEN_EXISTING, // existing file only FILE_ATTRIBUTE_NORMAL, // normal file NULL); // no attr. template
if (hFile == INVALID_HANDLE_VALUE) { ErrorHandler("Could not open file."); // process error }
UESE了就可以,特殊的要自己写声明
hFile = CreateFile("MYFILE.TXT", // open MYFILE.TXT
GENERIC_READ, // open for reading
FILE_SHARE_READ, // share for reading
NULL, // no security
OPEN_EXISTING, // existing file only
FILE_ATTRIBUTE_NORMAL, // normal file
NULL); // no attr. template
if (hFile == INVALID_HANDLE_VALUE)
{
ErrorHandler("Could not open file."); // process error
}