Hi
I have function:
control_input(string input){
if(input!="open"){
throw "Invalid command";
}
}
and i call it in main:
int main(){
string input;
cin<<input;
try{
control_input(input);
}
catch(strin e){
cout<<e<<endl;
}
return 0;
}
For some reason that does not work. If it is time to catch exception, my
program ends with that kind of message:
terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::at
Aborted
What is wrong and how to make it work correctly?
Juhan.