如何取得一个文件的文件名???(50分)

  • 主题发起人 主题发起人 hfjacklee
  • 开始时间 开始时间
H

hfjacklee

Unregistered / Unconfirmed
GUEST, unregistred user!
如何取得一个文件的文件名???
 
什么意思?
文件不是以文件名来标识吗?
 
可以使用FINDFIRST函数和FINDNEXT函数。
函数原型为:
function FindFirst(const Path: string; Attr: Integer; var F: TSearchRec): Integer;
描述:
FindFirst searches the directory specified by Path
for the first file that matches the file name implied by Path
and the attributes specified by the Attr parameter.
The result is returned in the F parameter.
Use the fields of this search record to extract the information needed.
FindFirst returns 0 if a file was successfully located,
otherwise, it returns an error code.
下面是TSearchRec的类型定义。
type
TSearchRec = record
Time: Integer;
Size: Integer;
Attr: Integer;
Name: TFileName;
ExcludeAttr: Integer;
FindHandle: THandle;
FindData: TWin32FindData;
end;
文件名就在NAME中存放着。
具体的情况还要你自己多多的去看DELPHI中的文档!
 
autoexecbat.bat -> autoexec

ChangeFileExt(FileName, '');
 
extractfilename
 
不能说清楚点?你想取哪里的文件的文件名?有何特征?楼上朋友说的够多方法了.
 
详细点如何?[:(]
 
后退
顶部