User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 429,817 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,395 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser: Programming Forums

Prog to list ASCII codes (beginners' stuff)

Join Date: Apr 2004
Posts: 3,657
Reputation: Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light 
Rep Power: 17
Solved Threads: 145
Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: Prog to list ASCII codes (beginners' stuff)

  #8  
Sep 24th, 2004
Originally Posted by Stack Overflow
Check out http://www.asciitable.com/

The full list of ASCII characters are there. The function isprint() knows which of the characters are printable. isprint() returns a nonzero value if the input is a printable character, including the space character (0x20 – 0x7E). The other characters are either extended, or do other features which aren't print friendly.

More information on isprint()
isprint() is included in the ctype library, ctype.h:

int isprint(int c);
» This function returns nonzero if c is a space or a character for which either isalnum() or ispunct() returns nonzero.

int isalnum(int c);
» This function returns nonzero if c is any of or other locale-specific alphabetic character.
According to AsciiTable.com
 Characters	ASCII
 a thru z	97 thru 122
 A thru Z	65 thru 90
 0 thru 9	48 thru 57
int ispunct(int c);
» This function returns nonzero if c is any of the following or other implementation-defined punctuation character:
According to AsciiTable.com
 Characters			ASCII
 ! " # $ % & ' ( ) * + , - . /	33 thru 47
 : ; < = > ? @			58 thru 64
 [ \ ] ^ _ '			91 thru 96
 { | } ~				123 thru 126

Hope this helps,
- Stack Overflow
The greater utility of functions like ispunct and isalnum are that they also work with other character sets, some of which, for example, do not necessarily have a contiguous alphabet or such. They are designed to work regardless of the particular implementation.
Reply With Quote  
All times are GMT -4. The time now is 5:26 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC