Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


extra numbers appearing....

This topic is 5704 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok, so Im trying to convert stings to ints.... Im using the strings found in and a couple of functions I built after reading some things off another site. The problem as the title suggests, is that Im getting extra numbers on the end. I thought it might be garbage, but it is always the same.... if I want to convert 15 I''ll get 150040105F.... weird.. anyway the first function is as follows:
string intToString(int x) {

	ostringstream stream;
	string temp;
	stream << x << ends;
	return(temp = stream.str());

}// end intToString()

and the second:
template<class T>
string ToString(const T& source)
  ostringstream oss;
  oss << source;
  return oss.str();
now the second did work if I had it declared in the same file as it was being used, but if it was put in a header and included then it added the numbers.... Im utterly confused by this... any ideas????

Share this post

Link to post
Share on other sites
good points both of them....

Im using VC++ 6.0 with all of the normal libs, so I guess their STL libs.... Im none to up to it with STL... anyway, Im re-buildin everything each time... ::shrug:: I have a hack in place that just removes the numbers off the end, but that could do a lot of damage so Im trying to find a way around it...

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!