Do You Coding?
[library] isprint ๊ตฌํํ๊ธฐ ๋ณธ๋ฌธ

๐ ๋งค๋ด์ผ (Linux)
SYNOPSIS
int isprint(int c);
: ํจ์ ํ๋กํ ํ์
DESCRIPTION
isprint()
checks for any printable character including space.
: ๋์ด์ฐ๊ธฐ๋ฅผ ํฌํจํ ์ธ์ ๊ฐ๋ฅํ ๋ฌธ์๊ฐ ์๋์ง ํ์ธํ๋ค
RETURN VALUE
The values returned are nonzero if the character c falls into the tested class, and zero if
not.
: ๋ฐํ๊ฐ์ ์กฐ๊ฑด์ ๋ง์กฑํ์ง ์์ผ๋ฉด 0์ด๊ณ , ๋ง์กฑํ๋ฉด 0์ด ์๋ ๊ฐ์ด๋ค
NOTES
The standards require that the argument c for these functions is either EOF or a value that is
representable in the type unsigned char. If the argument c is of type char, it must be cast
to unsigned char, as in the following example:
char c;
...
res = toupper((unsigned char) c);
This is necessary because char may be the equivalent of signed char, in which case a byte
where the top bit is set would be sign extended when converting to int, yielding a value that
is outside the range of unsigned char.
The details of what characters belong to which class depend on the locale. For example, isupโ
per() will not recognize an A-umlaut (Ä) as an uppercase letter in the default C locale.
๐ ์์ฑ ์ฝ๋
int do_isprint(int d)
{
if (d >= 32 && d <= 126)
return (1);
else
return (0);
}
๐ ์ฝ๋ ๋ฆฌ๋ทฐ
printable ํ, ์ฆ ์ถ๋ ฅ๊ฐ๋ฅํ ๋ฌธ์๋ค์ ASCII ํ ์์์ 32 (๋์ด์ฐ๊ธฐ) ๋ถํฐ 126 (~) ๊น์ง ์ด๋ค.
๋ฐ๋ผ์ ํด๋น ๋ฒ์์ ์์ผ๋ฉด isprint ํจ์์ ์ํด 1์ ๋ฐํํ๊ณ ์๋๋ฉด 0์ ๋ฐํํ๋๋ก ํ๋ค.
'CS & Engineering > C' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| [library] strlcpy ๊ตฌํํ๊ธฐ (0) | 2024.03.19 |
|---|---|
| [library] strlen ๊ตฌํํ๊ธฐ (0) | 2024.03.18 |
| [library] isascii ๊ตฌํํ๊ธฐ (0) | 2024.03.18 |
| [study] Linked List (์ฐ๊ฒฐ ๋ฆฌ์คํธ) (0) | 2024.03.14 |
| [library] isalnum ๊ตฌํํ๊ธฐ (0) | 2024.03.13 |