Previous: FSearch function To the Table of Content Next: GetCBreak procedure

- 4.24.2.14 -
Standard Units
Dos Unit
Dos Unit Procedures and Functions

FSplit procedure

Targets: MS-DOS, OS/2, Win32


Dos Unit

Splits a file name into its three components.

Declaration:
procedure FSplit(Path: PathStr;
                 var Dir: DirStr;
                 var Name: NameStr;
                 var Ext: ExtStr);
Remarks:
Use this procedure to break down a file specification into three parts: path, file name, and file extension. Path is of type PathStr which is defined in the Dos unit. Dir returns the path or directory part of Path. Name returns the actual file name without extension. Ext returns the file extension preceded by a period (.).

It is possible that one or more of the components be returned empty. This occurs if Path contains no such component. For instance, if there is no path, Dir is empty.

Example:
uses
  Dos;
var
  Fi    : File;
  Direc : DirStr;
  Fname : NameStr;
  Exten : ExtStr;
begin
  FSplit(ParamStr(1), Direc, Fname, Exten);
  if Fname = '' then Halt(1);
  Assign(Fi, ParamStr(1));
  Erase(Fi);
end.



Previous: FSearch function To the Table of Content Next: GetCBreak procedure
FSearch function Table of Content GetCBreak procedure

- 4.24.2.14 -