当前位置:首页 > 网络编程 > 软件语言 > DELPHI > Delphi中应用临时文件

Delphi中应用临时文件

点击次数:53 次 发布日期:2008-11-09 08:39:42 作者:源代码网
源代码网推荐
广告载入中
编程时也许需要产生一些临时文件,但这些文件最好是有唯一的文件名
源代码网推荐  才不会产生冲突,Windows API 提供了这一函数,具体用法如下,记得退出
源代码网推荐  之后,要把临时目录下一些的临时文件删掉。
源代码网推荐
源代码网推荐  unit frmCreateTempFile;
源代码网推荐
源代码网推荐  interface
源代码网推荐
源代码网推荐  uses
源代码网推荐   Windows, Messages, SysUtils, Classes, Graphics, Controls,
源代码网推荐   Forms, Dialogs,StdCtrls;
源代码网推荐
源代码网推荐  type
源代码网推荐   TForm1 = class(TForm)
源代码网推荐   Button1: TButton;
源代码网推荐   Edit1: TEdit;
源代码网推荐   Edit2: TEdit;
源代码网推荐   procedure Button1Click(Sender: TObject);
源代码网推荐   private
源代码网推荐   { Private declarations }
源代码网推荐   public
源代码网推荐 { Public declarations }
源代码网推荐 end;
源代码网推荐
源代码网推荐  var
源代码网推荐   Form1: TForm1;
源代码网推荐
源代码网推荐  implementation
源代码网推荐
源代码网推荐  {$R *.DFM}
源代码网推荐
源代码网推荐  procedure TForm1.Button1Click(Sender: TObject);
源代码网推荐  Var
源代码网推荐   Buf:string[40];
源代码网推荐   Pbuf:Pchar;
源代码网推荐   TmpFileName:String[40];
源代码网推荐   PFile:PChar;
源代码网推荐  begin
源代码网推荐   PBuf:=@buf;
源代码网推荐   PFile:=@fileName;
源代码网推荐
源代码网推荐     //获取临时目录名,即DOS环境变量Temp所指向的目录

源代码网推荐   GetTempPath(40,Pbuf);
源代码网推荐   Edit1.Text:=String(PBuf);
源代码网推荐
源代码网推荐   GetTEmpFileName(PBuf,"",0,PFile);
源代码网推荐   Edit2.Text:=String(PFile);
源代码网推荐
源代码网推荐  end;
源代码网推荐
源代码网推荐  end.


源代码网推荐

源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华