临沂万和热水器售后:对文件的创建、删除、修改、读取基本操作

来源:百度文库 编辑:偶看新闻 时间:2024/04/28 22:01:57
DeleteFile(L"E:\\test.txt"); /* HANDLE hFile = CreateFile(L"E:\\test.txt", GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS , FILE_ATTRIBUTE_NORMAL, 0); if (hFile == INVALID_HANDLE_VALUE) { return 0; } TCHAR pBufWrite[100] = L"200";
DWORD dwBytesToWrite = 100; DWORD dwBytesWrite = 0; if (!WriteFile(hFile, pBufWrite, dwBytesToWrite, &dwBytesWrite, NULL) || dwBytesWrite == 0) { CloseHandle(hFile); return 0; } TCHAR pBufRead[100] = {0,}; DWORD dwBytesToRead = 100; DWORD dwBytesRead = 0; if (!ReadFile(hFile, pBufRead, dwBytesToRead, &dwBytesRead, NULL) || dwBytesRead == 0) { CloseHandle(hFile); return 0; }
CloseHandle(hFile);*/