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. Regarding ASCII value to character

Regarding ASCII value to character

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
11 Posts 8 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.
  • H Offline
    H Offline
    H4u32
    wrote on last edited by
    #1

    Hello all, I want to get character value from an ASCII value. That is, if i pass 65 then I should get 'A' in return. So how could i easily accomplish this?? Please help me out.. Thanks & Regards, Hemang

    C C _ A R 6 Replies Last reply
    0
    • H H4u32

      Hello all, I want to get character value from an ASCII value. That is, if i pass 65 then I should get 'A' in return. So how could i easily accomplish this?? Please help me out.. Thanks & Regards, Hemang

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

      char c = 65;

      :)

      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.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

      C 1 Reply Last reply
      0
      • H H4u32

        Hello all, I want to get character value from an ASCII value. That is, if i pass 65 then I should get 'A' in return. So how could i easily accomplish this?? Please help me out.. Thanks & Regards, Hemang

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

        char c = 65; It's as easy as that. Now your c character holds the 'A' letter.

        Cédric Moonen Software developer
        Charting control [v1.4]

        1 Reply Last reply
        0
        • H H4u32

          Hello all, I want to get character value from an ASCII value. That is, if i pass 65 then I should get 'A' in return. So how could i easily accomplish this?? Please help me out.. Thanks & Regards, Hemang

          _ Offline
          _ Offline
          _AnsHUMAN_
          wrote on last edited by
          #4

          printf("%c",i); // i could have any integer value Put in other words you can simply typecast an int to a char to get its ASCII value

          Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

          1 Reply Last reply
          0
          • H H4u32

            Hello all, I want to get character value from an ASCII value. That is, if i pass 65 then I should get 'A' in return. So how could i easily accomplish this?? Please help me out.. Thanks & Regards, Hemang

            A Offline
            A Offline
            Akt_4_U
            wrote on last edited by
            #5

            CString csTemp; csTemp.Format( "%c", 65 ); Will result "A" in csTemp.

            akt

            1 Reply Last reply
            0
            • C CPallini

              char c = 65;

              :)

              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.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

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

              That's crazy... You gave the same answer than me and you got downvoted while I got a 5 :doh:

              Cédric Moonen Software developer
              Charting control [v1.4]

              C 1 Reply Last reply
              0
              • H H4u32

                Hello all, I want to get character value from an ASCII value. That is, if i pass 65 then I should get 'A' in return. So how could i easily accomplish this?? Please help me out.. Thanks & Regards, Hemang

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

                If you want a function anyway:

                char getCharEquivalent(int i)
                {
                char c = i;
                return c;
                }

                void main()
                {
                int i = 65;

                char cCharEquiv = getCharEquivalent(i);
                

                }

                Put a break point inside main and check cCharEquiv, it will be 'A' ASCII is nothing but numeric value of the character.

                -- "Programming is an art that fights back!"

                H 1 Reply Last reply
                0
                • H H4u32

                  Hello all, I want to get character value from an ASCII value. That is, if i pass 65 then I should get 'A' in return. So how could i easily accomplish this?? Please help me out.. Thanks & Regards, Hemang

                  S Offline
                  S Offline
                  sudhir_Kumar
                  wrote on last edited by
                  #8

                  char c= (char)65;

                  -@SuDhIrKuMaR@-

                  H 1 Reply Last reply
                  0
                  • C Cedric Moonen

                    That's crazy... You gave the same answer than me and you got downvoted while I got a 5 :doh:

                    Cédric Moonen Software developer
                    Charting control [v1.4]

                    C Offline
                    C Offline
                    CPallini
                    wrote on last edited by
                    #9

                    However, don't worry, I don't mind about down voters (and after all, I have a lot of friends). :-D

                    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.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                    1 Reply Last reply
                    0
                    • R rp_suman

                      If you want a function anyway:

                      char getCharEquivalent(int i)
                      {
                      char c = i;
                      return c;
                      }

                      void main()
                      {
                      int i = 65;

                      char cCharEquiv = getCharEquivalent(i);
                      

                      }

                      Put a break point inside main and check cCharEquiv, it will be 'A' ASCII is nothing but numeric value of the character.

                      -- "Programming is an art that fights back!"

                      H Offline
                      H Offline
                      H4u32
                      wrote on last edited by
                      #10

                      Though my problem was of different sort but i got clue from all your answers. So i am very thankful to you guys as usual. I am really touched. Cheers, Hemang

                      1 Reply Last reply
                      0
                      • S sudhir_Kumar

                        char c= (char)65;

                        -@SuDhIrKuMaR@-

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

                        Why char c= (char)65; when we can use of char c = 65; ?

                        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