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. VB's chr() function equivalent in vc++

VB's chr() function equivalent in vc++

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
26 Posts 6 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 vanip

    can anybody tell abt the VB's chr() equivalent in VC++?

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

    Please when asking things like that, explain what the function does. I'm not at all familiar with VB so I needed to check in the MSDN for the function. It looks like this function returns the char associated with an ASCII number, am I right ? There is no need to call a function in C++, just cast your integer into a char and that will do the trick: char NewChar = (char)65;

    V 1 Reply Last reply
    0
    • C Cedric Moonen

      Please when asking things like that, explain what the function does. I'm not at all familiar with VB so I needed to check in the MSDN for the function. It looks like this function returns the char associated with an ASCII number, am I right ? There is no need to call a function in C++, just cast your integer into a char and that will do the trick: char NewChar = (char)65;

      V Offline
      V Offline
      vanip
      wrote on last edited by
      #3

      Thanks for ur help! i tried the same way. But as i am not sure of correctness, i placed here.Thanks once again

      1 Reply Last reply
      0
      • V vanip

        can anybody tell abt the VB's chr() equivalent in VC++?

        N Offline
        N Offline
        Naveen
        wrote on last edited by
        #4

        in VC++ there is no need for the conversion... in vb Dim MyChar As Char MyChar = Chr(65) ' Returns "A". in vc++ char MyChar = 65; is enough nave

        C 1 Reply Last reply
        0
        • N Naveen

          in VC++ there is no need for the conversion... in vb Dim MyChar As Char MyChar = Chr(65) ' Returns "A". in vc++ char MyChar = 65; is enough nave

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

          Yes, but to avoid a warning because you are converting from int to char (possible loss of data), make the casting explicit: char MyChar = (char)65; -- modified at 4:51 Friday 21st April, 2006

          N T 2 Replies Last reply
          0
          • C Cedric Moonen

            Yes, but to avoid a warning because you are converting from int to char (possible loss of data), make the casting explicit: char MyChar = (char)65; -- modified at 4:51 Friday 21st April, 2006

            N Offline
            N Offline
            Naveen
            wrote on last edited by
            #6

            thanks nave

            1 Reply Last reply
            0
            • C Cedric Moonen

              Yes, but to avoid a warning because you are converting from int to char (possible loss of data), make the casting explicit: char MyChar = (char)65; -- modified at 4:51 Friday 21st April, 2006

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

              Cedric Moonen wrote:

              char MyChar = **(int)**65;

              you wanted to say (char), didn't you ?

              C 1 Reply Last reply
              0
              • T toxcct

                Cedric Moonen wrote:

                char MyChar = **(int)**65;

                you wanted to say (char), didn't you ?

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

                Yes, of course... Friday morning, end of week, brain tired, wanna go home ;P

                T 1 Reply Last reply
                0
                • C Cedric Moonen

                  Yes, of course... Friday morning, end of week, brain tired, wanna go home ;P

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

                  ok... so, as i'm not in the lounge, what do you do this wkend ? :laugh:

                  C 1 Reply Last reply
                  0
                  • T toxcct

                    ok... so, as i'm not in the lounge, what do you do this wkend ? :laugh:

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

                    Maybe start working on my article ;). You convinced me that it's time. Otherwise, maybe going out for a little walk (I think the weather will be nice on sunday), receiving friends, spend time with my girlfriend, ... Already heavily loaded :) And what about you ? And what about VisualCalc3 ? :)

                    T 1 Reply Last reply
                    0
                    • C Cedric Moonen

                      Maybe start working on my article ;). You convinced me that it's time. Otherwise, maybe going out for a little walk (I think the weather will be nice on sunday), receiving friends, spend time with my girlfriend, ... Already heavily loaded :) And what about you ? And what about VisualCalc3 ? :)

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

                      Cedric Moonen wrote:

                      Maybe start working on my article

                      ahh, good news !! :-D what will it be about ?

                      Cedric Moonen wrote:

                      And what about you ?

                      little wkend... this evening, party at a coleague, so i wont sleep a lot. saturday : sleep sleep sleep (and code, to entertain the fingers :rolleyes: ) sunday : i referee a rugby match at about 360kms (one way only - :( ) from home, so, wont be there neither... monday, let's go again for a one more run

                      Cedric Moonen wrote:

                      And what about VisualCalc3 ?

                      sources and article done... submitting this wkend

                      P C 2 Replies Last reply
                      0
                      • T toxcct

                        Cedric Moonen wrote:

                        Maybe start working on my article

                        ahh, good news !! :-D what will it be about ?

                        Cedric Moonen wrote:

                        And what about you ?

                        little wkend... this evening, party at a coleague, so i wont sleep a lot. saturday : sleep sleep sleep (and code, to entertain the fingers :rolleyes: ) sunday : i referee a rugby match at about 360kms (one way only - :( ) from home, so, wont be there neither... monday, let's go again for a one more run

                        Cedric Moonen wrote:

                        And what about VisualCalc3 ?

                        sources and article done... submitting this wkend

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

                        v2.0 wrote:

                        what will it be about ?

                        A charting control. It's been ages that I developped it, but never had the time to make an article (or, I always delayed it ;P).

                        v2.0 wrote:

                        and code, to entertain the fingers

                        What about playing guitar, to entertain the fingers also ;)

                        v2.0 wrote:

                        sources and article done... submitting this wkend

                        Cool, I'll have a look at it ;)

                        1 Reply Last reply
                        0
                        • T toxcct

                          Cedric Moonen wrote:

                          Maybe start working on my article

                          ahh, good news !! :-D what will it be about ?

                          Cedric Moonen wrote:

                          And what about you ?

                          little wkend... this evening, party at a coleague, so i wont sleep a lot. saturday : sleep sleep sleep (and code, to entertain the fingers :rolleyes: ) sunday : i referee a rugby match at about 360kms (one way only - :( ) from home, so, wont be there neither... monday, let's go again for a one more run

                          Cedric Moonen wrote:

                          And what about VisualCalc3 ?

                          sources and article done... submitting this wkend

                          P Offline
                          P Offline
                          Parthiban
                          wrote on last edited by
                          #13

                          hi, whr r u u guys from? i'm from india.

                          T 1 Reply Last reply
                          0
                          • P Parthiban

                            hi, whr r u u guys from? i'm from india.

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

                            i'm from another planet than earth, but Cedric is from Belgium (looking at his CP profile...)

                            N N C 3 Replies Last reply
                            0
                            • T toxcct

                              i'm from another planet than earth, but Cedric is from Belgium (looking at his CP profile...)

                              N Offline
                              N Offline
                              Naveen
                              wrote on last edited by
                              #15

                              What u guys have done with my thread...:( nave

                              N T 2 Replies Last reply
                              0
                              • N Naveen

                                What u guys have done with my thread...:( nave

                                N Offline
                                N Offline
                                Nishad S
                                wrote on last edited by
                                #16

                                Some relaxation is needed... :) - NS -

                                N 1 Reply Last reply
                                0
                                • T toxcct

                                  i'm from another planet than earth, but Cedric is from Belgium (looking at his CP profile...)

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

                                  Yes, France is definitively another planet with stange people :laugh:

                                  T 1 Reply Last reply
                                  0
                                  • T toxcct

                                    i'm from another planet than earth, but Cedric is from Belgium (looking at his CP profile...)

                                    N Offline
                                    N Offline
                                    Nishad S
                                    wrote on last edited by
                                    #18

                                    How is the climate there? ;) - NS -

                                    T 1 Reply Last reply
                                    0
                                    • N Nishad S

                                      Some relaxation is needed... :) - NS -

                                      N Offline
                                      N Offline
                                      Naveen
                                      wrote on last edited by
                                      #19

                                      u too from another planet...? nave

                                      1 Reply Last reply
                                      0
                                      • C Cedric Moonen

                                        Yes, France is definitively another planet with stange people :laugh:

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

                                        Cedric, who is from france ? i really don't see who you're talking about :rolleyes: see my profile, and remember a little discuss some weeks ago...

                                        C 1 Reply Last reply
                                        0
                                        • N Nishad S

                                          How is the climate there? ;) - NS -

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

                                          well, nice, this morning was at about 288°K, but our suns are hidden by a wide clouds layer... :doh:

                                          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