I have a class in my program that has a member variable, an int called number, and a member function, getName(), that is MEANT to return the words "Dice: #" as a const char\*, but with the # replaced by the number stored in the class.

```
const char* getName(){
 return "Dice:";
}

```

works perfectly well.

```
const char* getName(){
 std::stringstream ss;
 ss << number;
 std::string s;
 s = "Dice: " + ss.str();
 return s.c_str();
}

```

does NOT work fine, and returns what seems to be garbage. I can't figure out the correct way to go about this. If I use cout to print `s.c_str()` it prints what I expect.