BCX Console Demonstration Program s123.bas

' Shows how BCX can use C functions directly 

$HEADER
CHAR * Remove_All_White_Space(CHAR *);
$HEADER

DIM a$
DIM b$

a$ = "     this   is    a     test      "

b$ = Remove_All_White_Space(a$)

PRINT b$

END PROGRAM

! CHAR* Remove_All_White_Space(CHAR* str1)
! {
!  CHAR *obuf,*nbuf;
!  if (str1)
!   {
!    for (obuf=str1,nbuf=str1;*obuf;++obuf)
!     {
!      if (!isspace(*obuf))
!      *nbuf++=*obuf;
!     }
!   *nbuf=0;
!   }
!  return str1;
! }

Result:

thisisatest