This is weird ive never seen anything like it before. I swear its the boogeyman.
1 2 3 4
bool b;
cout << "Testing... " << endl; //makes it here
cin >> b; //crashes here after I input a number
cout << "Testing... " << endl; //doesn't make it here
But I've found I can:
1 2 3
char bc;
cin.get(bc);
b = bc - 48;
However if I use that method, I am no longer able to cout << b << endl;
Although I can still printf it.
Please help. What kinds of things could be causing this.
bool getencryptionmethod()
{
if (cin.fail()) {cin.clear(); clearcin(cin);}
english << "Encrypting or decrypting a message? \n";
english << "0. for Encryption. 1. for Decryption.\n" ;
bool rv;
carrotjews:cout<<'>';
cin >> rv;
if (cin.fail()) {clearcin(cin); cin.clear(); }
return rv;
}
It crashes at line 8. However if I comment out line 8 and replace it with rv = 0; it runs smoothly.
I was in the process of removing char pointers from my code as a whole and replacing them with strings. If that helps any. However I doubt it will because I had already replaced many lines of code and its impossible to say which, if any, if thats even the cause, had any effect.
I don't know. I just read through pretty much my entire program and I've eliminated practically any pointer that causing a dereference of an invalid pointer.