home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / MAGAZINE / DDJ9309.ZIP / NETSQL.ZIP / DEL_TRSP.CPP < prev    next >
C/C++ Source or Header  |  1993-04-30  |  600b  |  33 lines

  1. /*---------------------------------------------------------------------
  2.  
  3. DESCRIPTION: Self explainatory - deletes trailing spaces from string...
  4.  
  5. ---------------------------------------------------------------------*/
  6. #include "string.h"
  7. #define EOS '\0'
  8. int allspace(char *);
  9.  
  10. del_trsp(char *op_str)
  11. {
  12. register int loop;
  13. register int len;
  14.  
  15.    if ( allspace(op_str) )
  16.    {
  17.       op_str[0]=0;
  18.    }
  19.    else
  20.    {
  21.       len=strlen(op_str);
  22.       for (loop=len-1 ; loop>=0 && op_str[loop]==32 ; )
  23.       {
  24.      loop--;
  25.       }
  26.       op_str[loop+1]=EOS;
  27.    }
  28.    return(0);
  29.  
  30. }
  31.  
  32.  
  33.