home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / qbnewsl / qbnws201 / smallexe / smallfun.txt < prev   
Text File  |  1991-01-26  |  4KB  |  129 lines

  1.  
  2.  
  3. SMALLEXE: Functions and Subprograms
  4. T. G. Muench January 1991
  5.  
  6.  
  7. FileExist       FUNCTION
  8.  
  9.                 Description: Checks to see if a file exists so that
  10.                              it may be opened by BASIC
  11.  
  12.                 Usage:       EXIST = FileExist(FILE$)
  13.  
  14.                 Replaces:    No direct BASIC equivalent; use in place
  15.                              of BASIC's ON ERROR
  16.  
  17.                 Parameters:
  18.  
  19.                   Input      FILE$        File specification
  20.  
  21.                   Output     EXIST        TRUE / FALSE
  22.  
  23.                 Remarks:     Uses DOS function to open the specified
  24.                              file without causing a BASIC error
  25.  
  26.  
  27. GetInput        SUBROUTINE
  28.  
  29.                 Description: Gets user input from keyboard
  30.  
  31.                 Usage:       CALL GetInput(PROMPT$, ENTRY$)
  32.  
  33.                 Replaces:    INPUT "PROMPT$"; ENTRY$
  34.  
  35.                 Parameters:
  36.  
  37.                   Input      PROMPT$      Optional prompt to display
  38.  
  39.                   Output     ENTRY$       String entered by user
  40.  
  41.                 Remarks:     Very limited line editing - supports
  42.                              only BackSpace to correct backwards;
  43.                              there is also no check for off-screen
  44.  
  45.  
  46. InputLine       SUBROUTINE
  47.  
  48.                 Description: Input a line of text from a file
  49.  
  50.                 Usage:       CALL InputLine (IOCHAN, BUFSIZE, _
  51.                                              STATUS, TEXT$)
  52.  
  53.                 Replaces:    LINE INPUT #IOCHAN, TEXT$
  54.  
  55.                 Parameters:
  56.  
  57.                   Input      IOCHAN       I/O channel number
  58.  
  59.                              BUFSIZE      Size of I/O buffer to use
  60.  
  61.                              STATUS       Flags first access of file
  62.  
  63.                   Output     STATUS       Flags end of file
  64.  
  65.                              TEXT$        Line of text from file
  66.  
  67.                 Remarks:     Much faster than LINE INPUT #; make the
  68.                              buffersize as large as possible to min-
  69.                              imize accesses to the disk
  70.  
  71.  
  72. ReadData$       FUNCTION
  73.  
  74.                 Description: Returns the next string element from the
  75.                              passed data string
  76.  
  77.                 Usage:       STRVAR$ = ReadData$(DATA$)
  78.  
  79.                 Replaces:    READ STRVAR$
  80.  
  81.                 Parameters:
  82.  
  83.                   Input      DATA$        Data string to parse
  84.  
  85.                   Output     STRVAR$      Next element in DATA$
  86.  
  87.                 Remarks:     DATA$ must contain string elements sep-
  88.                              arated by commas with no spaces, i.e.
  89.                              "ONE,TWO,THREE"
  90.  
  91.  
  92. ReadTimer&      FUNCTION
  93.  
  94.                 Description: Returns the number of ticks elapsed
  95.                              since midnight
  96.  
  97.                 Usage:       TICKS& = ReadTimer&
  98.  
  99.                 Replaces:    START! = TIMER
  100.  
  101.                 Parameters:
  102.  
  103.                   Input      None
  104.  
  105.                   Output     TICKS&       Longword timer count
  106.  
  107.                 Remarks:     The clock ticks approximately 18.2 times
  108.                              per second; there is no checking for
  109.                              passing midnight when the clock is reset
  110.  
  111.  
  112. StrToInt&       FUNCTION
  113.  
  114.                 Description: Returns the long integer equivalent of
  115.                              a numeric string
  116.  
  117.                 Usage:       NUMBER& = StrToInt&(NUMSTR$)
  118.  
  119.                 Replaces:    NUMBER& = VAL(NUMSTR$)
  120.  
  121.                 Parameters:
  122.  
  123.                   Input      NUMSTR$      Numeric string to convert
  124.  
  125.                   Output     NUMBER&      Long integer equivalent
  126.  
  127.                 Remarks:     Stops when a non-numeric character is
  128.                              encountered; no check for overflow
  129.