SpiceBoolean iswhsp_c ( ConstSpiceChar * string )
Return a boolean value indicating whether a string contains
only white space characters.
None.
FILES, TEXT
Variable I/O Description
-------- --- --------------------------------------------------
string I String to be tested.
The function returns the boolean value SPICETRUE if the string is
empty or contains only white space characters; otherwise it returns
the value SPICEFALSE.
string is a character pointer designating a string to be
searched for non-white-space characters.
The function returns the boolean value SPICETRUE if the string
contains only white space characters; otherwise it returns the
value SPICEFALSE.
White space characters are those in the set
{ ' ', '\f', '\n', '\r', '\t', '\v' }
None.
1) If the input string pointer is null, the error SPICE(NULLPOINTER)
is signaled.
2) An empty string, that is a string with a null character
at index 0, is considered to be blank.
None.
This routine provides a short cut for testing lines for the presence
of non-blank characters; this is a test which is performed frequently
in CSPICE.
1) Read a text file; print the non-blank lines.
#include <stdio.h>
#include "SpiceUsr.h"
void main()
{
#define MAXLEN 82
FILE *fptr;
SpiceBoolean eof;
SpiceChar line [MAXLEN];
txtopr_c ( "myfile", &fptr );
readln_c ( fptr, MAXLEN, line, &eof );
while ( !eof )
{
if ( !iswhsp_c(line) )
{
printf ( "%s\n", line );
}
readln_c ( fptr, MAXLEN, line, &eof );
}
}
None.
1) "American National Standard for Programming Languages -- C,"
Published by the American National Standards Institute, 1990.
Section 7.3.1.9., p. 104.
N.J. Bachman (JPL)
-CSPICE Version 1.1.0, 27-AUG-1999 (NJB)
Now checks for null input string.
-CSPICE Version 1.0.0, 24-FEB-1999 (NJB)
Arguments passed to isspace are now cast to unsigned char to
suppress compilation warnings on some systems.
-CSPICE Version 1.0.0, 08-FEB-1998 (NJB)
read a non-blank line from a text file
Link to routine iswhsp_c source file iswhsp_c.c
|