FileName: String;
The FileName property returns name of the file represented as a stream.
Sub UserProc;
Var
Dir: IDirectoryInfo;
FileInf: IFileInfo;
FileStr: IFileStream;
s: String;
Begin
Dir:=New DirectoryInfo.Attach("c:\New_Folder");
If Dir.Exists Then
FileInf:=Dir.GetFiles("*").Item(0);
FileStr:=FileInf.Open(FileOpenMode.ReadWrite, FileShare.DenyWrite);
s:=FileStr.FileName;
End If;
Dispose Dir;
Dispose FileInf;
End Sub UserProc;
After executing the example the "s" variable contains name of the first file in the directory C:\New_Folder.
See also: