home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / turbopas / totdoc11.zip / CHAPT15.TXT < prev    next >
Text File  |  1991-02-11  |  7KB  |  178 lines

  1.                                                                    Miscellaneous
  2.  
  3.  
  4.          "I got the bill for my surgery. Now I know why those doctors were
  5.          wearing masks."
  6.  
  7.                                                                  James H. Barrie
  8.  
  9.  
  10.          The totMISC unit contains a grab-bag of miscellaneous procedures and
  11.          functions that don't logically fit anywhere else in the Toolkit! One
  12.          day they may grow up to have their own units. Some of these routines
  13.          are required by other parts of the Toolkit, and may be of little value
  14.          to you. Nonetheless, they are here if you need them. The procedures and
  15.          functions are organized into three categories: File, Printer and Misc.
  16.  
  17.  
  18. File Routines
  19.  
  20.          The following file related functions are included in the unit:
  21.  
  22.          Exist(Filename:string):boolean;
  23.  
  24.          This function returns true if a file can be found. The function is
  25.          passed one parameter indicating the name of the file to look for. The
  26.          filename may include an optional drive or path, and even filemasks are
  27.          supported.
  28.  
  29.          Copyfile(Sourcefile,Targetfile:string):byte;
  30.  
  31.          This function physically copies a file like the DOS copy command. The
  32.          function is passed two string parameters: the first string is the name
  33.          of the source file, and the second is the name of the target file. If a
  34.          file with the same name as Target already exists, it will be overwrit-
  35.          ten. The function returns one of the following byte values:
  36.               0     successful
  37.               1     source and target the same
  38.               2     cannot open source
  39.               3     unable to create target
  40.               4     error during copy
  41.  
  42.          The function uses a small 2048 byte buffer to copy the file. If you
  43.          want faster file copying, increase the buffer size by modifying the
  44.          variable declaration in the CopyFile function.
  45.  
  46.          FSize(Filename:string): longint;
  47.  
  48.          This function returns a longint indicating the size of a file in bytes.
  49.          The function is passed a single string parameter indicating the name of
  50.          the file. The name may optionally include a drive or path qualifier. If
  51.          the file is not found, a -1 is returned.
  52.  
  53. 15-2                                                                User's Guide
  54. --------------------------------------------------------------------------------
  55.  
  56.          FileDrive(Full:string): string;
  57.  
  58.          This function extracts and returns the drive letter (without the colon)
  59.          from a filename. The function is passed one string parameter indicating
  60.          the name of the file. If the name does not include a drive, a null is
  61.          returned, i.e. ''.
  62.  
  63.          FileDirectory(Full:string): string;
  64.  
  65.          This function extracts the directory path (without the drive letter)
  66.          from a filename. The function is passed one string parameter indicating
  67.          the name of the file. If the name does not include a path, a null is
  68.          returned, i.e. ''. The trailing backslash is always removed.
  69.  
  70.  
  71.          FileName(Full:string): string;
  72.  
  73.          This function extracts the file name (excluding the extension) from a
  74.          filename. The function is passed one string parameter indicating the
  75.          name of the file. If the string does not include a name, a null is
  76.          returned, i.e. ''.
  77.  
  78.          FileExt(Full:string): string;
  79.  
  80.          This function extracts the file extension (excluding the period) from a
  81.          filename. The function is passed one string parameter indicating the
  82.          name of the file. If the string does not include an extension, a null
  83.          is returned, i.e. ''.
  84.  
  85.  
  86.          SlashedDirectory(Dir:string): string;
  87.  
  88.          This function is useful for building fully-qualified filenames. The
  89.          function is passed one string parameter indicating the directory. The
  90.          same directory is returned, with a backslash added if the string did
  91.          not already terminate with a backslash or colon.
  92.  
  93.  
  94. Printer Routines
  95.  
  96.          The unit includes the following printer-related procedures and func-
  97.          tions:
  98.  
  99.          PrinterStatus: byte;
  100.  
  101.  
  102.  
  103. Miscellaneous                                                               15-3
  104. --------------------------------------------------------------------------------
  105.  
  106.          This function is designed to indicate if a parallel printer is attached
  107.          and on-line. The global variable LPTport indicates which port to test.
  108.          Set LPTport to 0 for LPT1 (default), 1 for LPT2, etc. The function
  109.          returns one of the following byte values to indicate the status of the
  110.          printer:
  111.  
  112.               0     printer ready
  113.               1     no paper
  114.               2     off line
  115.               3     busy
  116.               4     undetermined error
  117.  
  118.          AlternatePrinterStatus: byte;
  119.  
  120.          This function is very similar in operation to PrinterStatus but uses a
  121.          slightly different technique. If you have problems using PrinterStatus
  122.          with some wierdo printer, try this function instead.
  123.  
  124.          PrinterReady: boolean;
  125.  
  126.          This functions returns true if a printer is detected as being on-line
  127.          and ready.
  128.  
  129.          ResetPrinter;
  130.  
  131.          These procedure should reset any printer back to its default (boot-up)
  132.          settings.
  133.  
  134.          PrintScreen;
  135.  
  136.          This procedure emulates the user pressing the PrtScr key, and dumps the
  137.          visible display to the printer port.
  138.  
  139.  
  140. Misc. Routines
  141.  
  142.          You know you're in trouble when you are reading the Miscellaneous sec-
  143.          tion in the Miscellaneous chapter!
  144.          Listed below are the remaining Toolkit procedures and functions:
  145.  
  146.  
  147.          Beep;
  148.          You guessed! This function emits a brief, but nonetheless irritating,
  149.          beep from the PC speaker.
  150.  
  151.  
  152.          CurrentTime: string;
  153.  
  154.  
  155.  
  156. 15-4                                                                User's Guide
  157. --------------------------------------------------------------------------------
  158.  
  159.          This function returns a formatted string representing the current time
  160.          according to the PCs internal clock. The string uses the twelve hour
  161.          format HH:MM:SS a.m./p.m.
  162.  
  163.  
  164.          Swap(var A,B:longint);
  165.          This procedure is passed two longint variable parameters. The procedure
  166.          swaps the contents of the two variables, i.e. A is assigned the value
  167.          of B, and B is assigned the value of A.
  168.  
  169.  
  170.          WithinRange(Min,Max,Test:longint):boolean;
  171.          This function is passed three longint parameters. The function returns
  172.          true if the third value is greater than or equal to the first parameter
  173.          and less than or equal to the second parameter.
  174.  
  175.  
  176.          Be sure to check the README file for any routines that may have been
  177.          added to totMISC since the manual was printed.
  178.