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

SetWindowText

Scheduled Pinned Locked Moved C / C++ / MFC
help
6 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.
  • J Offline
    J Offline
    jj921
    wrote on last edited by
    #1

    Just starting out, Problem is that when I read a button name from a text file and assign it using a control variable and the setwindowtext function, i seem to get an extra character printed on the button. I am using fgets to read a string from a text file. Any help will be gratefully accepted. Phil

    D 1 Reply Last reply
    0
    • J jj921

      Just starting out, Problem is that when I read a button name from a text file and assign it using a control variable and the setwindowtext function, i seem to get an extra character printed on the button. I am using fgets to read a string from a text file. Any help will be gratefully accepted. Phil

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

      It sounds like the string also contains the newline character.


      "Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow

      J 1 Reply Last reply
      0
      • D David Crow

        It sounds like the string also contains the newline character.


        "Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow

        J Offline
        J Offline
        jj921
        wrote on last edited by
        #3

        So whats the easy way to get rid of this?

        D 1 Reply Last reply
        0
        • J jj921

          So whats the easy way to get rid of this?

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

          Replace it with a '\0' character.


          "Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow

          V 2 Replies Last reply
          0
          • D David Crow

            Replace it with a '\0' character.


            "Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow

            V Offline
            V Offline
            Vikram Kashyap
            wrote on last edited by
            #5

            ;P Fetch the content in a CString type variable and then use the TrimRight() function with no parameters. When used with no parameters, TrimRight removes trailing newline, space, and tab characters from the string. Vikram Kashyap "You will never fail until you stop trying"

            1 Reply Last reply
            0
            • D David Crow

              Replace it with a '\0' character.


              "Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow

              V Offline
              V Offline
              Vikram Kashyap
              wrote on last edited by
              #6

              ;P Fetch the content in a CString type variable and then use the TrimRight() function with no parameters. When used with no parameters, TrimRight removes trailing newline, space, and tab characters from the string. Vikram Kashyap "You will never fail, until you stop trying"

              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