Language:
Русский
English
{FileSplt.PAS}
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
{Sample code for the FileSplit function.}
uses Strings, WinCrt, WinDos;
var
Path: array[0..fsPathName] of Char;
Dir: array[0..fsDirectory] of Char;
Name: array[0..fsFileName] of Char;
Ext: array[0..fsExtension] of Char;
begin
Write('Filename (WORK.PAS): ');
Readln(Path);
FileSplit(Path, Dir, Name, Ext);
if Name[0] = #0 then StrCopy(Name, 'WORK');
if Ext[0] = #0 then StrCopy(Ext, '.PAS');
StrECopy(StrECopy(StrECopy(Path, Dir), Name), Ext);
Writeln('Resulting name is ', Path);
end.