cpfile.pas

来自「生物信息学中的遗传数据分析的delphi源码。」· PAS 代码 · 共 72 行

PAS
72
字号
{$I CPDIR.INC}

{*******************************************************************
*                                                                  *
*  COMPONENT for MS DOS and Windows source code.                   *
*                                                                  *
*  (c) 1992, Roderic D. M. Page                                    *
*                                                                  *
*  Language: Turbo Pascal (Pascal with object-oriented extensions) *
*  Compiler: Turbo Pascal 6.0 (MS DOS)                             *
*            Turbo Pascal for Windows 1.0 (WINDOWS)                *
*                                                                  *
*  Notes:    Program interface is currently Windows specific.      *
*                                                                  *
*******************************************************************}


unit cpfile;

{*
Basic file utilities
17 Nov 1992 ValidPath added.
*}


interface

uses
	Strings;

   function Exist (szFileName : PChar):Boolean;
      {True if file <\b szFileName> exists }
	function ValidPath (szFileName: PChar):Boolean;
      {True if file <\b szFileName> is a valid DOS path}

implementation

    { True if file szFileName exists }
    function Exist (szFileName: PChar): Boolean;
    var
      i : Word;
      f: text;
    begin
      {$I-}
      Assign(f, szFileName);
      Reset(f);
      Exist := (IOResult = 0);
      Close(f);
      {Clear ioresult}
      i := IOResult;
      {$I+}
	 end;


    { True if path is valid }
	 function ValidPath (szFileName: PChar):Boolean;
	 var
      i : Word;
      f : text;
    begin
      {$I-}
      Assign (f, szFileName);
      Rewrite (f);
      ValidPath := (IOResult = 0);
      Close(f);
      {Clear ioresult}
      i := IOResult;
      {$I+}
	 end;


end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?