Jul 24, 2008 at 8:51am
i am tryiny to concatenate these two strings
catch (exception& e) {
sError_ = "Standard Exception: " + e.what();
}
and it throws the follwing error
error: invalid operands of types `const char[21]' and `const char*' to binary `operator+'
is there a way around?
thanks
Jul 24, 2008 at 9:40am
Why not use the function for the concatenation of strings?
http://www.cplusplus.com/reference/clibrary/cstring/strcat.html
Perhaps like this (I don't know the lengths of exception strings, just assumed they'd be shorter than 128 characters):
1 2 3 4 5 6 7
|
catch (exception& e) {
sError1_ [150];
sError1_ = "Standard Exception: ";
SError2_ [128];
SError2_ = e.what();
strcat(sError1_, sError2_);
}
|
Edit: Yeah, my code is pretty broken, please don't use it.
Last edited on Jul 25, 2008 at 7:14am