Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Conversion from int to basic string

Conversion from int to basic string

Scheduled Pinned Locked Moved C / C++ / MFC
jsonquestion
27 Posts 9 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Nishad S

    what do you mean? :confused: - NS -

    T Offline
    T Offline
    toxcct
    wrote on last edited by
    #7

    remember the discussion below[^]

    1 Reply Last reply
    0
    • N Nishad S

      what do you mean? :confused: - NS -

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #8

      don't u know v2.0 is from another planet(An alien with vc++ knowledge) nave

      T 1 Reply Last reply
      0
      • N Nishad S

        wsprintf(str,"%d",n) is another way ;) - NS -

        C Offline
        C Offline
        Cedric Moonen
        wrote on last edited by
        #9

        I think he was asking how to convert an integer into a std::string directly

        I 1 Reply Last reply
        0
        • N Naveen

          don't u know v2.0 is from another planet(An alien with vc++ knowledge) nave

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #10

          :-D he might have jump over the post but now, it's cool, anybody knows... :->

          1 Reply Last reply
          0
          • T toxcct

            ;P but what did you do to my thread ?! :rolleyes::laugh:

            N Offline
            N Offline
            Naveen
            wrote on last edited by
            #11

            :doh: sorry don't attack my earth for my mistake...Please:(( nave

            T N 2 Replies Last reply
            0
            • C Cedric Moonen

              I think he was asking how to convert an integer into a std::string directly

              I Offline
              I Offline
              itkid
              wrote on last edited by
              #12

              U r right!!

              N 1 Reply Last reply
              0
              • N Naveen

                :doh: sorry don't attack my earth for my mistake...Please:(( nave

                N Offline
                N Offline
                Nishad S
                wrote on last edited by
                #13

                If he do so we can pause him... ;) He is providing C:\> prompt... Just type "pause" command there... :) - NS -

                N 1 Reply Last reply
                0
                • N Naveen

                  :doh: sorry don't attack my earth for my mistake...Please:(( nave

                  T Offline
                  T Offline
                  toxcct
                  wrote on last edited by
                  #14

                  hey, don't worry, i'm a pacific intergalactic traveler... my only purpose is to provide C/C++ knowledge around our universe ;)

                  N 1 Reply Last reply
                  0
                  • I itkid

                    U r right!!

                    N Offline
                    N Offline
                    Nishad S
                    wrote on last edited by
                    #15

                    Sorry I am not familar with that... - NS -

                    1 Reply Last reply
                    0
                    • N Nishad S

                      If he do so we can pause him... ;) He is providing C:\> prompt... Just type "pause" command there... :) - NS -

                      N Offline
                      N Offline
                      Naveen
                      wrote on last edited by
                      #16

                      v2.0 ... What does the c:\> prompt in ur profile indicates.. nave

                      T 1 Reply Last reply
                      0
                      • T toxcct

                        hey, don't worry, i'm a pacific intergalactic traveler... my only purpose is to provide C/C++ knowledge around our universe ;)

                        N Offline
                        N Offline
                        Nishad S
                        wrote on last edited by
                        #17

                        I have posted some suggestions about VisualCalc... Did you see that? - NS -

                        T 1 Reply Last reply
                        0
                        • N Naveen

                          v2.0 ... What does the c:\> prompt in ur profile indicates.. nave

                          T Offline
                          T Offline
                          toxcct
                          wrote on last edited by
                          #18

                          it indicates that you are at the root directory on the C: drive :rolleyes:

                          N N 2 Replies Last reply
                          0
                          • N Nishad S

                            I have posted some suggestions about VisualCalc... Did you see that? - NS -

                            T Offline
                            T Offline
                            toxcct
                            wrote on last edited by
                            #19

                            i did ;)

                            1 Reply Last reply
                            0
                            • I itkid

                              Hi Friend, Is there any API which convert int(int a) to basic string(string b)? itoa can convert a(int) to char*(Char *c) and I can get b from c.However is there any other way? Thanks :)

                              S Offline
                              S Offline
                              Stephen Hewitt
                              wrote on last edited by
                              #20

                              Here's how I'd go about doing it: ostringstream ss; ss << "PI = " << 3.14159265; string s = ss.str(); Includes you'll need:  <string>  <sstream> Assumes:  using namespace std; Steve

                              I 1 Reply Last reply
                              0
                              • T toxcct

                                it indicates that you are at the root directory on the C: drive :rolleyes:

                                N Offline
                                N Offline
                                Nishad S
                                wrote on last edited by
                                #21

                                Means we have to uncover a lot... right? And we are only at the root... ( philosophy ) :) - NS -

                                1 Reply Last reply
                                0
                                • T toxcct

                                  it indicates that you are at the root directory on the C: drive :rolleyes:

                                  N Offline
                                  N Offline
                                  Naveen
                                  wrote on last edited by
                                  #22

                                  I am serious man:| nave

                                  T A 2 Replies Last reply
                                  0
                                  • N Naveen

                                    I am serious man:| nave

                                    T Offline
                                    T Offline
                                    toxcct
                                    wrote on last edited by
                                    #23

                                    hum, so i didn't understand your question... in MS-DOS, C:\> is the common prompt to tell that you are located on the root directory of the C: drive. the ver command displays the actual version on MS-DOS installed (or windows since WinNT4 - as it doesn't need dos anymore) if i still don't answer your question, please rephrase:^)

                                    1 Reply Last reply
                                    0
                                    • I itkid

                                      Hi Friend, Is there any API which convert int(int a) to basic string(string b)? itoa can convert a(int) to char*(Char *c) and I can get b from c.However is there any other way? Thanks :)

                                      J Offline
                                      J Offline
                                      jhwurmbach
                                      wrote on last edited by
                                      #24

                                      itkid wrote:

                                      Is there any API which convert int(int a) to basic string(string b)?

                                      std::basic_string is a template. You can't convert to it, but only to its instantiations e.g. std::string or std::wstring That said, I would take a look at boost.orgs lexical cast[^] or format[^]. Free but peer-reviewed code. Some of it will be part of the next version of the C++-Standard.


                                      "We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.

                                      1 Reply Last reply
                                      0
                                      • N Naveen

                                        I am serious man:| nave

                                        A Offline
                                        A Offline
                                        Akt_4_U
                                        wrote on last edited by
                                        #25

                                        what is going on here........????? i just confused...:zzz::(( Akkott

                                        1 Reply Last reply
                                        0
                                        • S Stephen Hewitt

                                          Here's how I'd go about doing it: ostringstream ss; ss << "PI = " << 3.14159265; string s = ss.str(); Includes you'll need:  <string>  <sstream> Assumes:  using namespace std; Steve

                                          I Offline
                                          I Offline
                                          itkid
                                          wrote on last edited by
                                          #26

                                          Thank you very much Steve. It is really usefull. ;)

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups