• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Easy C++ question

convert the integer into a string.

Many methods exist. sprintf, itoc, etc

Using sprintf would allow you to use formatting to place the string and integer in the order that you desire.
 
you can send both of them into a stringstream with << and then get the resulting string as output.
 
Originally posted by: oog
you can send both of them into a stringstream with << and then get the resulting string as output.

OMG thanks i never knew about the stringstream class. I looked it up in my book and my problems are solved.
 
Originally posted by: EagleKeeper
convert the integer into a string.

Many methods exist. sprintf, itoc, etc

Using sprintf would allow you to use formatting to place the string and integer in the order that you desire.

Thanks also, these were the kinds of things i was trying before but having trouble with.
 
sprintf is legacy C stuff (won't work with std::string), not to mention a very common source of buffer overflows.

itoc must be some platform-specific thing.

stringstream is the way!
 
Back
Top