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. why doesn't TRACE output correctly?

why doesn't TRACE output correctly?

Scheduled Pinned Locked Moved C / C++ / MFC
questiondebugginghelp
5 Posts 5 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.
  • L Offline
    L Offline
    liuyue
    wrote on last edited by
    #1

    CString strTemp strTemp.Format("%-60s%-20.1f\r\n%-60s%-20.1f\r\n%-60s%-20.1f\r\n","Global Wall",0,"Limiting Potential",0,"Roughness Correlation",0); TRACE("output:%s\n",strTemp); when debugging, the output is: output:Global Wall 0.0 (null) 0.0 ? -2.0 how can i dispose of the problem?

    W K B D 4 Replies Last reply
    0
    • L liuyue

      CString strTemp strTemp.Format("%-60s%-20.1f\r\n%-60s%-20.1f\r\n%-60s%-20.1f\r\n","Global Wall",0,"Limiting Potential",0,"Roughness Correlation",0); TRACE("output:%s\n",strTemp); when debugging, the output is: output:Global Wall 0.0 (null) 0.0 ? -2.0 how can i dispose of the problem?

      W Offline
      W Offline
      Weiye Chen
      wrote on last edited by
      #2

      Remove "\r". Weiye Chen Life is hard, yet we are made of flesh...

      1 Reply Last reply
      0
      • L liuyue

        CString strTemp strTemp.Format("%-60s%-20.1f\r\n%-60s%-20.1f\r\n%-60s%-20.1f\r\n","Global Wall",0,"Limiting Potential",0,"Roughness Correlation",0); TRACE("output:%s\n",strTemp); when debugging, the output is: output:Global Wall 0.0 (null) 0.0 ? -2.0 how can i dispose of the problem?

        K Offline
        K Offline
        kakan
        wrote on last edited by
        #3

        Try casting your 0 to (float) 0 Now, they are int's.

        1 Reply Last reply
        0
        • L liuyue

          CString strTemp strTemp.Format("%-60s%-20.1f\r\n%-60s%-20.1f\r\n%-60s%-20.1f\r\n","Global Wall",0,"Limiting Potential",0,"Roughness Correlation",0); TRACE("output:%s\n",strTemp); when debugging, the output is: output:Global Wall 0.0 (null) 0.0 ? -2.0 how can i dispose of the problem?

          B Offline
          B Offline
          Blake Miller
          wrote on last edited by
          #4

          CString strTemp strTemp.Format("%-60s%-20.1f\r\n%-60s%-20.1f\r\n%-60s%-20.1f\r\n","Global Wall",(float)0.0,"Limiting Potential",(float)0.0,"Roughness Correlation",(float)0.0); // important to case the CString since the TRACE does not know argument type TRACE("output:%s\r\n",(LPCTSTR)strTemp);

          1 Reply Last reply
          0
          • L liuyue

            CString strTemp strTemp.Format("%-60s%-20.1f\r\n%-60s%-20.1f\r\n%-60s%-20.1f\r\n","Global Wall",0,"Limiting Potential",0,"Roughness Correlation",0); TRACE("output:%s\n",strTemp); when debugging, the output is: output:Global Wall 0.0 (null) 0.0 ? -2.0 how can i dispose of the problem?

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

            All you need to do is replace each 0 with 0.0 instead. When Format() encountered the %f, it attempted to pop a float type from the stack but got an int type instead.


            "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

            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