Hallo. I seem to be having trouble with exceptions. For instance, the following code:
string str="PARAM_1:15";
try{
int assig=str.find('=',0);
if(assig==string::npos)throw("Cannot find equals sign."
}
catch(const char* msg){
ShowMessage(msg);
}
I am obviously wrong in expecting this snippet to produce the message "Cannot find equals sign.", but I have no idea why.
The execution of the code falls over on the fourth line with the message "raised exception class char * with message 'Exception Object Address:0x11A68AA'."
Changing the catch parameter to a char* instead of const char* hasn't fixed it.
I'm obviously missing a very basic point, but have no idea where to look.
Can anyone offer any insight?
All help gratefully recieved,
Douglas JL
Common sense is what tells you the world is flat.
string str="PARAM_1:15";
try{
int assig=str.find('=',0);
if(assig==string::npos)throw("Cannot find equals sign."
}
catch(const char* msg){
ShowMessage(msg);
}
I am obviously wrong in expecting this snippet to produce the message "Cannot find equals sign.", but I have no idea why.
The execution of the code falls over on the fourth line with the message "raised exception class char * with message 'Exception Object Address:0x11A68AA'."
Changing the catch parameter to a char* instead of const char* hasn't fixed it.
I'm obviously missing a very basic point, but have no idea where to look.
Can anyone offer any insight?
All help gratefully recieved,
Douglas JL
Common sense is what tells you the world is flat.