home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource4 / 273_01 / triml.cc < prev    next >
Text File  |  1987-09-27  |  505b  |  20 lines

  1. trim_l(char *str)
  2. /* This will remove all blanks from the left side of the string
  3.    pointed to by *str.
  4. */
  5. {
  6.         int non_blank_found = 0;
  7.         char *newstr;
  8.         newstr=str;
  9.         while(*str) {
  10.                 if(*str==' ' && !non_blank_found)
  11.                         str++;
  12.                 else {
  13.                         non_blank_found=1;
  14.                         *newstr=*str;
  15.                         newstr++; str++;
  16.                 }
  17.         }
  18.         *newstr=0x00;
  19. }
  20.