This documentation is copyright © 1998-2001 Sandro Sigala <sandro@sigala.it>.
All rights reserved.

Released under the GNU General Public License.

Return to index Return to header Previous symbol Next symbol

isspace

Prototype

#include <ctype.h>

int isspace(int c);

Description

In the ``C'' locale, returns a true value if the c character is a standard white-space character (space ' ', form feed '\f', new line '\n', carriage return '\r', horizontal tab '\t', and vertical tab '\v'). In other implementation-defined set of characters returns true for the characters for which isalnum is false.

Example

View source
#include <ctype.h>
#include <stdio.h>

/*
 * Get the next token separated by white spaces from the
 * standard input.
 */
char *gettoken(char *buf)
{
    char *dp = buf;
    int c;

    while (isspace(c = getchar()))
	;	/* Skip white spaces. */
    if (c == EOF)
	return NULL;
    do
	*dp++ = c;
    while (!isspace(c = getchar()));
    *dp = '\0';

    return buf;
}

References

ISO C 9899:1990 7.3.1.9