method to convert integer to string

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mthread

    method to convert integer to string

    Hi,
    I would like to know the method to convert integer to string.
    Thanx in advance.
  • Ian Collins

    #2
    Re: method to convert integer to string

    mthread wrote:
    Hi,
    I would like to know the method to convert integer to string.
    Use a stringstream.

    --
    Ian Collins.

    Comment

    • Ondra Holub

      #3
      Re: method to convert integer to string

      On 14 Ún, 08:22, mthread <rjk...@gmail.c omwrote:
      Hi,
      I would like to know the method to convert integer to string.
      Thanx in advance.
      #include <string>
      #include <sstream>

      // Fn should return true if conversion succeeded
      template<typena me INT>
      bool ToInt(const std::string& s, INT& i)
      {
      std::istringstr eam iss(s);
      s >i;
      return !iss.bad();
      }

      Comment

      • red floyd

        #4
        Re: method to convert integer to string

        mthread wrote:
        Hi,
        I would like to know the method to convert integer to string.
        Thanx in advance.
        I heard about this great new tool on the web that lets you search for stuff.

        It's called "Google". You really should try it.

        Comment

        • Gianni Mariani

          #5
          Re: method to convert integer to string

          mthread wrote:
          Hi,
          I would like to know the method to convert integer to string.
          Thanx in advance.
          This is how:

          Download Austria for free. The Austria C++ library provides a host of essential C++ tools including but generic factories, smart pointers, logging, unit testing framework and parameters/configuration system. The library will work with both Linux/GCC and win32/MVC++.


          I think the c.l.c++ faq lite has some more info.

          Comment

          Working...