special characters

This is a discussion on special characters within the C Programming forums, part of the General Programming Boards category; What's the shortcut for getting the smiley face character? I know if you hold down the Alt key and press ...

  1. #1
    Un Artiste Extraordinaire volk's Avatar
    Join Date
    Dec 2002
    Posts
    357

    special characters

    What's the shortcut for getting the smiley face character?

    I know if you hold down the Alt key and press 171, you get the half symbol.

    Is there a website that lists all of the Alt Key shortcuts for special characters?

  2. #2
    Registered User Vber's Avatar
    Join Date
    Nov 2002
    Posts
    807

  3. #3
    Un Artiste Extraordinaire volk's Avatar
    Join Date
    Dec 2002
    Posts
    357
    I didn't see the smiley face and the heart, etc.

    This code should show you all of the characters that weren't found at that website:

    Code:
    #include <stdio.h>
    
    int main( void )
    
    {
    	int c;
    	
    	for (c = 0; c < 256; c++)
    
    		printf ("%d %c\n", c, c);
    
    	return 0;
    }

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Blame that on your OS. They are not "the smiley face symbol", etc. They are actual values which end up being displayed incorrectly. Think of it as your computer trying to draw you a null character. Furthermore, it will depend on what font your terminal is using. One font gives you one thing for 'extended characters', another may give you something entirely different.

    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    Originally posted by quzah
    Furthermore, it will depend on what font your terminal is using. One font gives you one thing for 'extended characters', another may give you something entirely different.
    It's not that they're extended, the VALUES are a part of ASCII (they are the beginning -- the first 32 of the ascii set), it's just that they don't have a direct character interpretation so it's up to the implementor to provide one (if they choose to do so). Extended refers to the values after the last defined value in ascii (127). Things like the smiley faces, hearts, clubs, musical notes, etc. are used to graphically represent in a single character things like "line feed," etc. that you wouldn't normally associate with a graphic.

    So what it comes down to is your font set very-well may not even have a smiley face yet still be able to represent all ascii values (in fact, most modern fonts don't). It just happens that the default terminal font and many other older raster fonts started their own convention of representing these values as the smiley face and other symbols you may or may not be familiar with.

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    If you look at their original post, they specificly reference ALT+171. This is considered an "extended character", meaning it doesn't fall within the first 128 characters (0-127). That's what I was referring to for the extended characters.

    But yes, the 0-32 aren't considered extended, they're just considered unprintable. This is the reason they give us nice little functions like isprint. (For the original poster's use/reference, not necessarily yours, as I doubt you need it.)

    Quzah.
    Hope is the first step on the road to disappointment.

  7. #7
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669
    32 is a space and it is printable.
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

  8. #8
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    32 is a space and it is printable.
    I said the first 32 not the first 33

    Remember that little number 0

  9. #9
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669
    I was refering to the quzah's reply. He wrote "0-32".
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 10
    Last Post: 07-10-2008, 03:45 PM
  2. Special Characters
    By mikeman118 in forum Windows Programming
    Replies: 18
    Last Post: 12-09-2007, 11:49 AM
  3. special characters removing from srting
    By cnu_sree in forum C Programming
    Replies: 5
    Last Post: 06-06-2007, 08:30 PM
  4. Special characters and sending them to programs...
    By Dragoon_42 in forum C++ Programming
    Replies: 5
    Last Post: 01-23-2006, 03:49 PM
  5. Special (non) Keyboard Characters
    By TechWins in forum C++ Programming
    Replies: 3
    Last Post: 05-01-2002, 12:08 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21