home *** CD-ROM | disk | FTP | other *** search
- ' +----------------------------------------------------------------------+
- ' | |
- ' | BASWIZ Copyright (c) 1990-1993 Thomas G. Hanlin III |
- ' | |
- ' | The BASIC Wizard's Library |
- ' | |
- ' +----------------------------------------------------------------------+
-
- DECLARE SUB FSDone0 ()
- DECLARE SUB FSNewBlock (ErrCode%)
- DECLARE SUB FSSet0 (Handle%, St$, Reallocate%, ErrCode%)
-
- DEFINT A-Z
-
- SUB FSDone
- FSDone0 ' deallocate string blocks
- junk& = SETMEM(999999) ' return memory to QuickBASIC
- END SUB
-
- SUB FSSet (Handle, St$)
- Tmp$ = LEFT$(St$, 255) ' truncate string if need be
- FSSet0 Handle, Tmp$, Reallocate, ErrCode ' try to set string value
- IF ErrCode THEN ' if error...
- '-----PRINT "Invalid handle in FSSet" ' invalid handle, ignore it
- ELSEIF Reallocate THEN ' if we need more room...
- junk& = SETMEM(-16400) ' get it from QuickBASIC
- FSNewBlock ErrCode ' make a new string block
- junk& = SETMEM(16400) ' return it (in case of EMS)
- IF ErrCode THEN ' if error...
- '--------PRINT "Out of far string space"
- ERROR 7 ' "out of memory" error
- ELSE
- FSSet0 Handle, Tmp$, Reallocate, ErrCode ' set string value
- '--------IF Reallocate OR ErrCode THEN
- '-----------PRINT "Error in FSSet0 code"
- '-----------PRINT "Error code: "; ErrCode
- '-----------PRINT "Reallocate: "; Reallocate
- '--------END IF
- END IF
- END IF
- END SUB
-