Gentoo Archives: gentoo-user

From: Kevin O'Gorman <kogorman@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] C programming use of isascii(), ispunct() and isblank() fails
Date: Thu, 05 Oct 2006 21:17:35
Message-Id: 9acccfe50610051410u44292b4ava0e58d6289ad73fa@mail.gmail.com
1 Why is it that using some of the macros from ctype.h fails to compile?
2 In particular, the three mentioned in the subject: line.
3
4 Try this:
5
6 #include <stdio.h>
7 #include <ctype.h>
8
9 int main(int argc, char *argv[])
10 {
11 int i;
12 for (i = 0; i < 256; i++) {
13 printf("%3d: ",i);
14 if (isalpha(i)) printf(" alpha");
15 if (isalnum(i)) printf(" alnum");
16 if (isascii(i)) printf(" ascii");
17 if (isblank(i)) printf(" blank");
18 if (iscntrl(i)) printf(" cntrl");
19 if (isdigit(i)) printf(" digit");
20 if (isgraph(i)) printf(" graph");
21 if (islower(i)) printf(" lower");
22 if (isprint(i)) printf(" print");
23 if (ispunct(i)) punctf(" punct");
24 if (isspace(i)) printf(" space");
25 if (isupper(i)) printf(" upper");
26 if (isxdigit(i)) printf(" xdigit");
27 printf("\n");
28 }
29
30 return 0;
31 }
32
33
34 --
35 Kevin O'Gorman, PhD
36 --
37 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] C programming use of isascii(), ispunct() and isblank() fails "Boyd Stephen Smith Jr." <bss03@××××××××××.net>
Re: [gentoo-user] C programming use of isascii(), ispunct() and isblank() fails "Boyd Stephen Smith Jr." <bss03@××××××××××.net>