SMALLEXE: Functions and Subprograms T. G. Muench January 1991 FileExist FUNCTION Description: Checks to see if a file exists so that it may be opened by BASIC Usage: EXIST = FileExist(FILE$) Replaces: No direct BASIC equivalent; use in place of BASIC's ON ERROR Parameters: Input FILE$ File specification Output EXIST TRUE / FALSE Remarks: Uses DOS function to open the specified file without causing a BASIC error GetInput SUBROUTINE Description: Gets user input from keyboard Usage: CALL GetInput(PROMPT$, ENTRY$) Replaces: INPUT "PROMPT$"; ENTRY$ Parameters: Input PROMPT$ Optional prompt to display Output ENTRY$ String entered by user Remarks: Very limited line editing - supports only BackSpace to correct backwards; there is also no check for off-screen InputLine SUBROUTINE Description: Input a line of text from a file Usage: CALL InputLine (IOCHAN, BUFSIZE, _ STATUS, TEXT$) Replaces: LINE INPUT #IOCHAN, TEXT$ Parameters: Input IOCHAN I/O channel number BUFSIZE Size of I/O buffer to use STATUS Flags first access of file Output STATUS Flags end of file TEXT$ Line of text from file Remarks: Much faster than LINE INPUT #; make the buffersize as large as possible to min- imize accesses to the disk ReadData$ FUNCTION Description: Returns the next string element from the passed data string Usage: STRVAR$ = ReadData$(DATA$) Replaces: READ STRVAR$ Parameters: Input DATA$ Data string to parse Output STRVAR$ Next element in DATA$ Remarks: DATA$ must contain string elements sep- arated by commas with no spaces, i.e. "ONE,TWO,THREE" ReadTimer& FUNCTION Description: Returns the number of ticks elapsed since midnight Usage: TICKS& = ReadTimer& Replaces: START! = TIMER Parameters: Input None Output TICKS& Longword timer count Remarks: The clock ticks approximately 18.2 times per second; there is no checking for passing midnight when the clock is reset StrToInt& FUNCTION Description: Returns the long integer equivalent of a numeric string Usage: NUMBER& = StrToInt&(NUMSTR$) Replaces: NUMBER& = VAL(NUMSTR$) Parameters: Input NUMSTR$ Numeric string to convert Output NUMBER& Long integer equivalent Remarks: Stops when a non-numeric character is encountered; no check for overflow