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. CString::Format

CString::Format

Scheduled Pinned Locked Moved C / C++ / MFC
question
32 Posts 11 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.
  • B Bravoone_2006

    "%g" is not working !How can i do that ?

    Bravoone

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

    Bravoone_2006 wrote:

    How can i do that ?

    by reading the CString::Format() documentation ! :zzz:


    [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

    R 1 Reply Last reply
    0
    • _ _AnsHUMAN_

      don't use atoi(). instead use atof() I think you must read the documentation rather than starting to build on the project. atoi converts a string to int and not to a float and then when you add them it returns an int in uSum which is just printed as a float value.

      Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

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

      _AnShUmAn_ wrote:

      I think you must read the documentation rather than starting to build on the project

      no, you forget the prerequisite step : learn C++ :doh: this guy is f*cking too lazy and keeps asking since months now dumb questions


      [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

      _ 1 Reply Last reply
      0
      • B Bravoone_2006

        ok but... : uSum += atof( csText); warning C4244: '+=' : conversion from 'double' to 'int', possible loss of data Why?

        Bravoone

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

        WTF !!! can't you understand the error message ??????

        Bravoone_2006 wrote:

        warning C4244: '+=' : conversion from 'double' **to 'int'**, possible loss of data

        to int mean you're writing in an int ! you know what ? go by a C/C++ book and learn that language biefore trying to use it any further (or swith to VB :zzz: )


        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

        1 Reply Last reply
        0
        • B Bravoone_2006

          ok but... : uSum += atof( csText); warning C4244: '+=' : conversion from 'double' to 'int', possible loss of data Why?

          Bravoone

          C Offline
          C Offline
          CPallini
          wrote on last edited by
          #24

          :-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.

          1 Reply Last reply
          0
          • B Bravoone_2006

            How can i make this : i have this code : csText.Format("%d", nSum); ok but my result is lets say 44,ok but if i have 22.3+22.3=44.6(nSum) this is not working : csText.Format("%d", nSum); How can i make this?(to have the result whit 44.6 lets say not 44)

            Bravoone

            realJSOPR Offline
            realJSOPR Offline
            realJSOP
            wrote on last edited by
            #25

            Dude - take a class or buy a book.

            "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
            -----
            "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

            T D 2 Replies Last reply
            0
            • T toxcct

              _AnShUmAn_ wrote:

              I think you must read the documentation rather than starting to build on the project

              no, you forget the prerequisite step : learn C++ :doh: this guy is f*cking too lazy and keeps asking since months now dumb questions


              [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

              _ Offline
              _ Offline
              _AnsHUMAN_
              wrote on last edited by
              #26

              :wtf: Forgot that :-O

              toxcct wrote:

              learn C++

              Thats the tricky part :suss:. If the things remain the same even after learning :laugh:. That could be the reason he isn't trying that.

              Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

              1 Reply Last reply
              0
              • realJSOPR realJSOP

                Dude - take a class or buy a book.

                "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                -----
                "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

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

                thanks for your valueable answer. can you give me a working code in this regard please ? :cool:


                [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                1 Reply Last reply
                0
                • C CPallini

                  Bravoone_2006 wrote:

                  csText.Format("%.2f", nSum); is not working why?

                  What do you mean with the generic is not working? :confused: Please detail the misbehaviour (i.e. obtained result vs expected result). BTW Have you correctly declared nSum as floating point number? :)

                  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.

                  H Offline
                  H Offline
                  Hamid Taebi
                  wrote on last edited by
                  #28

                  Maybe he's new to c++.:-D


                  WhiteSky


                  1 Reply Last reply
                  0
                  • T toxcct

                    Bravoone_2006 wrote:

                    How can i do that ?

                    by reading the CString::Format() documentation ! :zzz:


                    [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                    R Offline
                    R Offline
                    Rajesh R Subramanian
                    wrote on last edited by
                    #29

                    toxcct wrote:

                    by reading the CString::Format() documentation !

                    How can I do that?


                    Nobody can give you wiser advice than yourself. - Cicero

                    1 Reply Last reply
                    0
                    • realJSOPR realJSOP

                      Dude - take a class or buy a book.

                      "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                      -----
                      "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

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

                      How would he do that?


                      "A good athlete is the result of a good and worthy opponent." - David Crow

                      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                      realJSOPR 1 Reply Last reply
                      0
                      • D David Crow

                        How would he do that?


                        "A good athlete is the result of a good and worthy opponent." - David Crow

                        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                        realJSOPR Offline
                        realJSOPR Offline
                        realJSOP
                        wrote on last edited by
                        #31

                        I don't know why, but this guys is really starting to piss me off. I spent almost an hour writing my response to him a few threads down, assuming he was at least semi-capable as a C++ programmer.

                        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                        -----
                        "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                        D 1 Reply Last reply
                        0
                        • realJSOPR realJSOP

                          I don't know why, but this guys is really starting to piss me off. I spent almost an hour writing my response to him a few threads down, assuming he was at least semi-capable as a C++ programmer.

                          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                          -----
                          "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

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

                          John Simmons / outlaw programmer wrote:

                          I don't know why, but this guys is really starting to piss me off.

                          Is there anything that doesn't, John? How people can get so riled over stuff like this is beyond me. If he bothers you so, why not just ignore him and move on?

                          John Simmons / outlaw programmer wrote:

                          I spent almost an hour writing my response to him a few threads down, assuming...

                          That was your second mistake.


                          "A good athlete is the result of a good and worthy opponent." - David Crow

                          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                          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