Thread: Printing characters not in the ASCII table

  1. #1

    Post Printing characters not in the ASCII table

    I am wrining a program to print a report, and I need to display the pound-sign character () on this report. Each instance of this character prints out as a space (I am using the fprintf() function to print). I assume this is because the character is not in the ASCII table. How can I print this character? Do I need to include a certain header file?

  2. #2
    Registered User
    Join Date
    Sep 2001
    It's char # 156 I think...
    #include <stdio.h>
    int main ()
     int c;
     int i;
     // There are 256 ascii characters, from 0 to 255.
     // A lot of the values just can't be displayed.  For example, there is
     //  the newline character, a backspace character, a tab character, and
     //  probably the most entertaining one, the beep character.
     for (c = 0; c < 256; )
     // Adjust the stopping value for i accordingly.
      for (i = 0; i < (80) / 7 && c < 256; i++, c++)
       printf ("%3d %c  ", c, c);
      // Depending on stopping value, this may or may not be commented out.
      printf ("\n");
     return 0;
    Callou collei we'll code the way
    Of prime numbers and pings!

  3. #3
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    According to my old (yet trusty) ASCII chart, the pound symbol has a decimal value of 156. However, my computer uses Unicode instead of ASCII. I used this program to show me all of the symbols available with my font:

    #include <stdio.h>
    int main(void)
      unsigned char c;
      for ( c=0; ; c++ )
        printf( "%03d %c\n", c, c );
        if ( c == 255 )
      return (0);
    You may be experiencing a similar problem, where your system's font doesn't use extended ASCII.
    Jason Deckard

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Printing only certain characters
    By dmkanz07 in forum C Programming
    Replies: 9
    Last Post: 04-18-2007, 07:40 AM
  2. ASCII Table
    By peckitt99 in forum C Programming
    Replies: 21
    Last Post: 10-09-2006, 01:53 AM
  3. ASCII Printable Characters
    By dalek in forum C# Programming
    Replies: 3
    Last Post: 08-11-2003, 04:13 AM
  4. ascii characters
    By Denethor2000 in forum C++ Programming
    Replies: 3
    Last Post: 03-20-2002, 05:26 AM
  5. Printing extended ASCII characters
    By Jonny M in forum C Programming
    Replies: 2
    Last Post: 03-01-2002, 10:12 AM