Thread: decimal ascII character

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    6

    decimal ascII character

    hello.
    i know i can use printf( "\xHH" ); to print an ascII character, in HH hex number.
    But, how can i do it using a number in decimal format? something like that: printf( "\DDD" ); and DDD is a decimal number.

    Regards
    Thanks

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    You can't. You can do it in octal, but not in decimal. Just convert the decimal to hexadecimal in your head and use the \x notation.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Didn't you post the same question in the C forum?

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    http://cboard.cprogramming.com/showthread.php?t=103422
    And don't copy/paste the same question over many forums / threads.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Character to Ascii
    By tdep in forum C Programming
    Replies: 6
    Last Post: 07-10-2006, 03:07 PM
  2. about wide character and multiple byte character
    By George2 in forum C Programming
    Replies: 3
    Last Post: 05-22-2006, 08:11 PM
  3. Problem with loop stopping at wrong time
    By Baron in forum C Programming
    Replies: 11
    Last Post: 12-14-2005, 08:35 PM
  4. HEEEELP: Letters to ASCII decimal equivalents?
    By Mazerius in forum C++ Programming
    Replies: 7
    Last Post: 10-30-2002, 09:56 AM
  5. Replies: 1
    Last Post: 07-31-2002, 10:49 AM