#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    38
    Rep Power
    12

    VB's Asc(), Chr() functionality in C++


    Does any one know of a function in C++ that is the same as Visual Basics Asc() and Chr(). I am converting a program and need something simialer. In VB Asc() converts an ascii character into its decimal value and Chr() then converts it back to the character. Thank you.
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,184
    Rep Power
    2222
    You don't need them. A character can be used as a character or as a numeric value, that value being its ASCII code. And a number can be interpreted as a character.

    For example, to convert a number 0..15 to a hex digit:
    char hex = (num < 10) ? '0' + num : 'A' + (num - 10);
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    38
    Rep Power
    12
    Thank you!

IMN logo majestic logo threadwatch logo seochat tools logo