[C++] 纯文本查看 复制代码
int _tmain(int argc, _TCHAR* argv[])
{
HANDLE fh;
TCHAR String[] = _T("Hello, world."), c; //Buffer[8] = _T("12345678"), c;
int command;
OVERLAPPED ov = {0, 0, 0, 0, NULL};
DWORD nRead = 0, nWrite = 0;
if (argc < 2) {
_tprintf (_T("No file name and command"));
exit (EXIT_FAILURE);
}
//command = _ttoi(argv[2]);
fh = CreateFile (argv[1], GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (fh == INVALID_HANDLE_VALUE) {
_tprintf (_T("Cannot open file\\n"));
exit (1);
}
_tprintf (_T("\\nType any character to release the share lock"));
_tscanf (_T("%c"), &c);
_tprintf (_T("Ok, exit now\\n"));
return 0;
}