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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Passing parameters to function problem.

Passing parameters to function problem.

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
4 Posts 4 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.
  • V Offline
    V Offline
    viral_umang hotmail com
    wrote on last edited by
    #1

    Hi! I am using rich edit box in my application in VC6. I am getting the content of the rich edit box and taking the bunch of three characters at a time to pass its value to a function. The function having 3 arguments of the type _TCHAR. Now when i am passing the value for this 3 arguments say 225,226,227 which is my bunch of 3 characters taken from the rich editbox the function changes this values to negative values like -31,-32,-33. Can anybody tell me what is the problem? Thanks in advance. Viral

    C R CPalliniC 3 Replies Last reply
    0
    • V viral_umang hotmail com

      Hi! I am using rich edit box in my application in VC6. I am getting the content of the rich edit box and taking the bunch of three characters at a time to pass its value to a function. The function having 3 arguments of the type _TCHAR. Now when i am passing the value for this 3 arguments say 225,226,227 which is my bunch of 3 characters taken from the rich editbox the function changes this values to negative values like -31,-32,-33. Can anybody tell me what is the problem? Thanks in advance. Viral

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

      Are you sure that it is not just a formatting problem, are you formatting them as unsigned?

      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
      • V viral_umang hotmail com

        Hi! I am using rich edit box in my application in VC6. I am getting the content of the rich edit box and taking the bunch of three characters at a time to pass its value to a function. The function having 3 arguments of the type _TCHAR. Now when i am passing the value for this 3 arguments say 225,226,227 which is my bunch of 3 characters taken from the rich editbox the function changes this values to negative values like -31,-32,-33. Can anybody tell me what is the problem? Thanks in advance. Viral

        R Offline
        R Offline
        rp_suman
        wrote on last edited by
        #3

        Can you tell Where the values are changing? Do you mean the function getting different values other than you want to pass (or) the parameters changed after the function call? Without source code its difficult to guess what is the problem. Best Regards, Suman

        1 Reply Last reply
        0
        • V viral_umang hotmail com

          Hi! I am using rich edit box in my application in VC6. I am getting the content of the rich edit box and taking the bunch of three characters at a time to pass its value to a function. The function having 3 arguments of the type _TCHAR. Now when i am passing the value for this 3 arguments say 225,226,227 which is my bunch of 3 characters taken from the rich editbox the function changes this values to negative values like -31,-32,-33. Can anybody tell me what is the problem? Thanks in advance. Viral

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          A char represents a signed byte. The bit patterns of the unsigned chars {225,226,227} are, of course, the same of the chars {-31,-32,-33}{-31,-30,-29}. You have to cast the data unsigned char, before passing it to your function.

          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.

          In testa che avete, signor di Ceprano?

          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