_str = new char(_len+1);
By using parenthesis instead of square brackets there, you are allocating a single char and initializing it with a strange value. I'm pretty sure you meant to allocate an array.
_str = new char[_len+1];
But since you already allocated temp
, why not just use that?
_str = temp;
// strcpy(_str, temp); // delete this line
This fixes your memory leak too. You weren't freeing the memory allocated for temp
, but with this method, you don't have to.