Re: std::string, Append a number
From: Matt Hurd (matt.hurd_at_gmail.com)
Date: 09/21/04
- Next message: Matt Hurd: "Re: std::string and strtod()"
- Previous message: Ioannis Vranos: "Re: C++ Objects, Stack or Heap? [Noob question]"
- In reply to: Andre Kostur: "Re: std::string, Append a number"
- Next in thread: Zian Smith: "Re: std::string, Append a number"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 21 Sep 2004 00:14:32 -0700
Andre Kostur <nntpspam@kostur.net> wrote in message news:<Xns956A70E3D3F1Enntpspamkosturnet@207.35.177.135>...
> .. or look up the lexical_cast<> item in Boost (http://www.boost.org)...
> (which I think does the same thing :) )
Yes, boost::lexical_cast is nicer, it hides the stream usage.
Specific reference here: http://www.boost.org/libs/conversion/lexical_cast.htm
This is the code, FYI, using your example.
#include <iostream>
#include <boost/lexical_cast.hpp>
int main()
{
int k = 56;
std::string blah(" ");
blah += boost::lexical_cast<std::string>(k);
std::cout << "\n\n" << blah << "\n\n";
}
Regards,
Matt Hurd
www.hurd.com.au
- Next message: Matt Hurd: "Re: std::string and strtod()"
- Previous message: Ioannis Vranos: "Re: C++ Objects, Stack or Heap? [Noob question]"
- In reply to: Andre Kostur: "Re: std::string, Append a number"
- Next in thread: Zian Smith: "Re: std::string, Append a number"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|