home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / BASIC / ACCEPT.ZIP / GETDATA.BAS < prev    next >
Encoding:
BASIC Source File  |  1987-08-02  |  723 b   |  26 lines

  1. '   GETDATA.BAS
  2. '       This subprogram returns a string of length nc% from the screen
  3. '       starting at location r%, c%.  Before return, the string is
  4. '       stripped of spaces, control characters, and the sc% character.
  5.  
  6.     SUB getData (r%, c%, nc%, D$, sc%) STATIC
  7.         r1% = r%: c1% = c%
  8.         D$ = ""
  9.         FOR i% = 1 to nc%
  10.             x% = SCREEN(r1%, c1%)
  11.             IF x% = sc% THEN
  12.                 D$ = D$ + " "
  13.             ELSE
  14.                 D$ = D$ + CHR$(x%)
  15.             END IF
  16.             c1% = c1% + 1
  17.             IF c1% > 80 THEN c1% = c1% - 80: r1% = r1% + 1
  18.  
  19.         NEXT i%
  20.  
  21.         i% = 3 ' strip from both ends
  22.         CALL STRIPBLANKS(D$, i%, nc%) ' new length in nc%
  23.         D$ = LEFT$(D$, nc%)
  24.  
  25.     END SUB
  26.