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. particular double to CString to edit control

particular double to CString to edit control

Scheduled Pinned Locked Moved C / C++ / MFC
iosquestion
4 Posts 3 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.
  • D Offline
    D Offline
    Desmo16
    wrote on last edited by
    #1

    Hi all, I read a double (2.567656e-010) from file, then I convert it into CString and finally i put it in an edit control, but the value is too small so in the edit control i find 0.000000. Here you have the code i use, toremove is the variable linked to the edit control: double var=0; std::fstream f_load; f_load.open("C:\\best_pop.txt",std::ios::in); f_load>>var; CString tmp; tmp.Format("%lf",var); toremove.SetWindowText(tmp); What should i do to see 2.567656e-010 in the edit control ?

    R 1 Reply Last reply
    0
    • D Desmo16

      Hi all, I read a double (2.567656e-010) from file, then I convert it into CString and finally i put it in an edit control, but the value is too small so in the edit control i find 0.000000. Here you have the code i use, toremove is the variable linked to the edit control: double var=0; std::fstream f_load; f_load.open("C:\\best_pop.txt",std::ios::in); f_load>>var; CString tmp; tmp.Format("%lf",var); toremove.SetWindowText(tmp); What should i do to see 2.567656e-010 in the edit control ?

      R Offline
      R Offline
      Ranjan Shrestha
      wrote on last edited by
      #2

      Use tmp.Format("%g", var); It should work.

      D 1 Reply Last reply
      0
      • R Ranjan Shrestha

        Use tmp.Format("%g", var); It should work.

        D Offline
        D Offline
        Desmo16
        wrote on last edited by
        #3

        it works ! Thanx !

        H 1 Reply Last reply
        0
        • D Desmo16

          it works ! Thanx !

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

          And also you can use of wsprintf


          WhiteSky


          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