Index Page
iswhsp_c
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 

Procedure
Abstract
Required_Reading
Keywords
Brief_I/O
Detailed_Input
Detailed_Output
Parameters
Exceptions
Files
Particulars
Examples
Restrictions
Literature_References
Author_and_Institution
Version
Index_Entries

Procedure

   SpiceBoolean iswhsp_c ( ConstSpiceChar * string ) 

Abstract

 
   Return a boolean value indicating whether a string contains
   only white space characters.
 

Required_Reading

 
   None. 
 

Keywords

 
   FILES,  TEXT 
 

Brief_I/O

 
   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.
 

Detailed_Input

   string     is a character pointer designating a string to be 
              searched for non-white-space characters.
              

Detailed_Output

   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' }
                 
               

Parameters

 
   None. 
 

Exceptions

 
   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.
   

Files

 
   None. 
 

Particulars

 
   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.
    

Examples

 
   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 );
            }
         }
 

Restrictions

 
   None. 
 

Literature_References

 
   1)  "American National Standard for Programming Languages -- C,"
        Published by the American National Standards Institute, 1990. 
        Section 7.3.1.9., p. 104.
 

Author_and_Institution

 
   N.J. Bachman (JPL) 
 

Version

 
   -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)

Index_Entries

 
   read a non-blank line from a text file 
 
Wed Apr  5 17:54:37 2017