在這個for循環中,cin.get();每隔一段時間都會跳過。我不知道爲什麼它被跳過。任何幫助將不勝感激。C++ for循環跳過cin.get()
代碼:cin.get之間
for(Pointer = StartPointer; Pointer < EndPointer; Pointer += MemInfo.RegionSize)
{
VirtualQueryEx(hProc, (LPCVOID)(Pointer), &MemInfo, sizeof(MemInfo));
cout << "MemInfo AllocationBase: " << MemInfo.AllocationBase << endl;
cout << "MemInfo AllocationProtect: " << MemInfo.AllocationProtect << endl;
cout << "MemInfo BaseAddress: " << MemInfo.BaseAddress << endl;
cout << "MemInfo Protect: " << MemInfo.Protect << endl;
cout << "MemInfo RegoinSize: " << MemInfo.RegionSize << endl;
cout << "MemInfo State: " << MemInfo.State << endl;
cout << "MemInfo Type: " << MemInfo.Type << endl;
cout << "MemInfo Size: " << sizeof(MemInfo) << endl;
cout << "Starter pointer is: " << StartPointer << endl;
cin.get();
}
實施例輸出();
MemInfo AllocationBase: 00000000
MemInfo AllocationProtect: 0
MemInfo BaseAddress: 00000000
MemInfo Protect: 1
MemInfo RegoinSize: 65536
MemInfo State: 65536
MemInfo Type: 0
MemInfo Size: 28
Starter pointer is: 0
MemInfo AllocationBase: 00010000
MemInfo AllocationProtect: 4
MemInfo BaseAddress: 00010000
MemInfo Protect: 4
MemInfo RegoinSize: 65536
MemInfo State: 4096
MemInfo Type: 262144
MemInfo Size: 28
Starter pointer is: 0
每隔一段時間?你在進什麼? –
這可能解釋您的問題。它是否正在閱讀你的換行符? http://stackoverflow.com/questions/2012268/cin-get-and-omitting-newline-char – dcaswell
你是否在使用'\ r \ n'的系統上輸入密碼,因爲它是換行符分隔符? – KitsuneYMG