[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
isprint/isspace segfaulting
From: |
Raj |
Subject: |
isprint/isspace segfaulting |
Date: |
Wed, 10 Dec 2003 11:00:18 +0530 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031016 |
Hi all,
Using isprint or isspace is resulting in a segfault. Program attached below.
This on RedHat 9.0, using glibc-common-2.3.2-11.9, glibc-2.3.2-11.9,
glibc-devel-2.3.2-11.9,
glibc-kernheaders-2.4-8.10.
PS: In the below program if i declare 'ch' as 'char', then things work
fine. Only when it is declared as 'int' does the problem shows up.
Is this expected ?
Thx for any info.
/Raj
-------------Start of program-----------
#include <ctype.h>
int main()
{
unsigned int ch; //Change this to char or unsigned char.
scanf("%c",&ch);
if(!isspace(ch)){//isprint also has the same problem
puts("NO");
}
else {
puts("YES");
}
}
--------------End of program------------------
- isprint/isspace segfaulting,
Raj <=