[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
isspace() Test for White-Space Character
#include <ctype.h>
int isspace(c);
int c; Integer value to be tested
isspace() tests if 'c' is a white-space character; that is, a
horizontal tab, a new-line, a vertical tab, a form-feed, a
carriage-return or a space.
Returns: True (nonzero) if the integer satisfies the test
condition or false (zero) if it does not. The result is
undefined if 'c' is other than an ASCII character or EOF.
Notes: isspace() is a macro.
-------------------------------- Example ---------------------------------
The following statements read characters from a file and put each
word (characters set off by a space) on a separate line.
#include <ctype.h>
#include <stdio.h>
FILE *stream;
int ch;
int x = 0;
main()
{
if ((stream = fopen("data.txt","r+")) != NULL) {
while (!feof(stream))
if(isspace(ch = getc(stream))) {
fputchar('\n');
x = 0;
}
else
fputchar(ch);
}
}
See Also:
isalnum()
isalpha()
isascii()
isdigit()
isgraph()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson