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

CString

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
17 Posts 7 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

    i need something more simple, its not exist something more simple then this? thank you !

    Bravoone

    G Offline
    G Offline
    GuyM
    wrote on last edited by
    #8

    Sorry, but this is as simple as it gets ... ;)

    1 Reply Last reply
    0
    • B Bravoone_2006

      i need something more simple, its not exist something more simple then this? thank you !

      Bravoone

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

      Bravoone_2006 wrote:

      its not exist something more simple then this?

      no.


      Maximilien Lincourt Your Head A Splode - Strong Bad

      1 Reply Last reply
      0
      • B Bravoone_2006

        i need something more simple, its not exist something more simple then this? thank you !

        Bravoone

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

        More simple than a copy/paste ?? :confused:


        Cédric Moonen Software developer
        Charting control [v1.2 - Updated]

        D 1 Reply Last reply
        0
        • C Cedric Moonen

          More simple than a copy/paste ?? :confused:


          Cédric Moonen Software developer
          Charting control [v1.2 - Updated]

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

          That's two operations, Cedric. Can't you trim it down to one? Quit making folks work so hard.


          "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

          T 1 Reply Last reply
          0
          • B Bravoone_2006

            i need something more simple, its not exist something more simple then this? thank you !

            Bravoone

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

            you idiot. someone gives you a function you just have top copy/paste in your code and call, but always you complain. :suss:


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

            1 Reply Last reply
            0
            • D David Crow

              That's two operations, Cedric. Can't you trim it down to one? Quit making folks work so hard.


              "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

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

              copy/paste == 2 ...processing reduction... shoot in the ass == 1 reduction performed successfully :jig:


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

              1 Reply Last reply
              0
              • G GuyM

                Try this function: void RoundString(CString& str) { float fVal = 0; swscanf_s(str, L"%f", &fVal); int nTemp = (int)((fVal + 0.005)*100); fVal = (float)((float)nTemp/100); str.Format(L"%.4f", fVal); }

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

                your example will compile only if UNICODE is defined... you should use _T(), stscanf() and so on...


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

                B G 2 Replies Last reply
                0
                • T toxcct

                  your example will compile only if UNICODE is defined... you should use _T(), stscanf() and so on...


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

                  B Offline
                  B Offline
                  Bravoone_2006
                  wrote on last edited by
                  #15

                  ok ! i understand you but you don t understand ME ! Le t say if someoane say : " You are not so smart if you use 6 lines of code for this ! " All i want is to find a way to make this function more simple , because he use to mutch code for this function ! for this function !? think about it its just ROUND ! make this : 16.0697 to 16.0700 to use sutch code!? the code is fine but no one say its wrong! i remind you i have CDialog base aplication, i have for ex: m_edit CEdit; m_edit2 CEdit; i must use for ex: OnChange m_edit; CString sT1,sT2; m_edit.GetWindowText(sT1); ... ... ... m_edit2.SetWindowText(sT2);

                  Bravoone

                  C 1 Reply Last reply
                  0
                  • B Bravoone_2006

                    ok ! i understand you but you don t understand ME ! Le t say if someoane say : " You are not so smart if you use 6 lines of code for this ! " All i want is to find a way to make this function more simple , because he use to mutch code for this function ! for this function !? think about it its just ROUND ! make this : 16.0697 to 16.0700 to use sutch code!? the code is fine but no one say its wrong! i remind you i have CDialog base aplication, i have for ex: m_edit CEdit; m_edit2 CEdit; i must use for ex: OnChange m_edit; CString sT1,sT2; m_edit.GetWindowText(sT1); ... ... ... m_edit2.SetWindowText(sT2);

                    Bravoone

                    C Offline
                    C Offline
                    cp9876
                    wrote on last edited by
                    #16

                    It is almost certainly possible to write your function in one line - but the advice that you are getting from professional programmers here is not to do that. What it does will be the same, the syntax just more complex. If this is not simple enough for you, find a better way. Before you complain about the solution someone has bothered to give you, engage brain and think of what is involved (having one solution in front of you should help). In this case the simplest way I can see to round the contents of one edit box is to get the string, convert to a floating point representation, round and convert back to a string. If you can find a better way, we have shared one solution with you, please share yours with us.


                    Peter "Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

                    1 Reply Last reply
                    0
                    • T toxcct

                      your example will compile only if UNICODE is defined... you should use _T(), stscanf() and so on...


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

                      G Offline
                      G Offline
                      GuyM
                      wrote on last edited by
                      #17

                      You're absolutely right !!! Thanks !!

                      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