例如:HANDLEhFile=CreateFile(fileName,GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);HANDLEhFileB=hFile;//不使用这种方法//DuplicateHandle(GetCurrentProcess(),hFile,GetCurrentProcess(),ReadFile(hFile,for(intcnt=0;cnt!=10;cnt)cout(int)buffer[cnt]\"\";coutendl;ReadFile(hFileB,for(intcnt=0;cnt!=10;cnt)cout(int)buffer[cnt]\"\";coutendl;CloseHandle(hFile);system(\"pause\");return0;这样做有没有什么问题?
|