Previous: 4.24.2.13. FSearch To the Table of Contents Next: 4.24.2.15. GetCBreak
4.24.2.13. FSearch Table of Contents 4.24.2.15. GetCBreak

- 4.24.2.14. -
Table of Contents
4. Standard Units
4.24. DOS - MSDOS support unit
4.24.2. DOS Unit Procedures and Functions
4.24.2.14. FSplit


4.24.2.14. FSplit

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: 4.24.2.13. FSearch To the Table of Contents Next: 4.24.2.15. GetCBreak
4.24.2.13. FSearch Table of Contents 4.24.2.15. GetCBreak

- 4.24.2.14. -