Cin >> str throws "Unhandled Exception (ntdll.dll) Read Access Violation ..."

I used VS2012 Ultimate to debug a simple Tester2 test project that contains only one Source.cpp source file:

//Source.cpp
#include<iostream>
#include<string>
#include<stdlib.h>
using namespace std;

int main()
{
    string s;
    cin>>s;
    return 0;
//Error occurrs after this line.
}

Error message: Error message window

Then it leads me to a file called xdebug: xdebug

Call stack: Call stack

After setting the breakpoints, I found that an error occurs after the string "return 0".

I suppose that some pointer deleted at the end did not stand out yet ... But I do not know how to solve it.

The same error occurs on VS2010.

Thanks a lot!

+4
source share

Source: https://habr.com/ru/post/1614638/


All Articles