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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how can i convert CString to int?

how can i convert CString to int?

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelplearning
17 Posts 7 Posters 1 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.
  • M mazizi

    hi i'm a beginner. i want to write a calculator but i don't know how can i convert CString to int. i search in MSDN but it was useless! :( please help me. thanks.

    CPalliniC Offline
    CPalliniC Offline
    CPallini
    wrote on last edited by
    #6

    If you're entering values in a edit box, for instance, then you don't need such conversion at all: you may directly map a integer variable to the edit box content. :)

    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
    [My articles]

    In testa che avete, signor di Ceprano?

    M 1 Reply Last reply
    0
    • CPalliniC CPallini

      If you're entering values in a edit box, for instance, then you don't need such conversion at all: you may directly map a integer variable to the edit box content. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      M Offline
      M Offline
      mazizi
      wrote on last edited by
      #7

      i use this but i can't set a int variable because of adding number with button like windows calculator. see it. thanks for ur attention.

      CPalliniC M 2 Replies Last reply
      0
      • C chandu004

        many more thanks for correcting me.

        -------------------------------------------- Suggestion to the members: Please prefix your main thread subject with [SOLVED] if it is solved. thanks. chandu.

        M Offline
        M Offline
        mazizi
        wrote on last edited by
        #8

        thanks 4 ur attention. 4 sure, i test it and say the result.

        1 Reply Last reply
        0
        • _ _Superman_

          Use _ttoi.

          «_Superman_» I love work. It gives me something to do between weekends.

          M Offline
          M Offline
          mazizi
          wrote on last edited by
          #9

          thanks 4 ur attention.

          1 Reply Last reply
          0
          • M mazizi

            i use this but i can't set a int variable because of adding number with button like windows calculator. see it. thanks for ur attention.

            CPalliniC Offline
            CPalliniC Offline
            CPallini
            wrote on last edited by
            #10

            If you're using buttons to enter numbers, then why do you need a CString variable? :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            In testa che avete, signor di Ceprano?

            M 1 Reply Last reply
            0
            • M mazizi

              i use this but i can't set a int variable because of adding number with button like windows calculator. see it. thanks for ur attention.

              M Offline
              M Offline
              Michael Schubert
              wrote on last edited by
              #11

              Why don't you post the piece of code you have a problem with?

              CPalliniC 1 Reply Last reply
              0
              • M Michael Schubert

                Why don't you post the piece of code you have a problem with?

                CPalliniC Offline
                CPalliniC Offline
                CPallini
                wrote on last edited by
                #12

                Coz we all know u r a (in)famous corporate espionage guy, sir. :-D

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                In testa che avete, signor di Ceprano?

                M 1 Reply Last reply
                0
                • CPalliniC CPallini

                  Coz we all know u r a (in)famous corporate espionage guy, sir. :-D

                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                  [My articles]

                  M Offline
                  M Offline
                  Michael Schubert
                  wrote on last edited by
                  #13

                  OK, I admit it. We have been looking for the calculator code for years. Busted...

                  CPalliniC 1 Reply Last reply
                  0
                  • M Michael Schubert

                    OK, I admit it. We have been looking for the calculator code for years. Busted...

                    CPalliniC Offline
                    CPalliniC Offline
                    CPallini
                    wrote on last edited by
                    #14

                    Michael Schubert wrote:

                    We have been looking for the calculator code for years

                    Well, you should know: there is NO code inside, there's a little man...[^]. :-D

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                    [My articles]

                    In testa che avete, signor di Ceprano?

                    1 Reply Last reply
                    0
                    • M mazizi

                      hi i'm a beginner. i want to write a calculator but i don't know how can i convert CString to int. i search in MSDN but it was useless! :( please help me. thanks.

                      D Offline
                      D Offline
                      David Crow
                      wrote on last edited by
                      #15

                      mazizi wrote:

                      i search in MSDN but it was useless!

                      I suspect it was your search criteria that was. Did you consider atoi()? See here.

                      "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                      1 Reply Last reply
                      0
                      • CPalliniC CPallini

                        If you're using buttons to enter numbers, then why do you need a CString variable? :)

                        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                        [My articles]

                        M Offline
                        M Offline
                        Michael Schubert
                        wrote on last edited by
                        #16

                        Obfuscation.

                        CPalliniC 1 Reply Last reply
                        0
                        • M Michael Schubert

                          Obfuscation.

                          CPalliniC Offline
                          CPalliniC Offline
                          CPallini
                          wrote on last edited by
                          #17

                          Yes! To deceive the enemy! You're right! :-D

                          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                          [My articles]

                          In testa che avete, signor di Ceprano?

                          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