Quote:
Originally posted by hk_mp5kpdw
Your string variable temp is declared locally to the function convert_num. When the function exits, any variable/objects that you declare in such a manner are effectively destroyed and therefore unavailable to any function that calls convert_num and relies upon getting a valid string object returned from it. What you need to do is either pass in an additional string parameter (by pointer/reference) and modify that object in the function, or modify the function to return a pointer to a string object that you dynamically allocate and modify within the convert_num function.
What you're saying is very wrong. std::string doesn't work that way at all.