Description |
The ProcessPath procedure splits a full file name FullName into its constituent Drive, Dir and FileName parts.
|
|
Related commands |
|
|
|
Example code : Ask the user for a file name, and show the constituent parts |
var
selectedFile : string;
drive : char;
path, fileName : string;
begin // Ask the user to select a file
if PromptForFileName(selectedFile)
then
begin // Display this full file/path value
WriteLn('Selected file = '+selectedFile);
// Split this full file/path value into its constituent parts
ProcessPath(selectedFile, drive, path, fileName);
WriteLn('drive = '+drive);
WriteLn('path = '+path);
WriteLn('fileName = '+fileName);
end;
end;
|
Show full unit code |
{ The user selects C:\Files\data.txt and hits OK }
Selected file = C:\Files\data.txt
drive = C
path = \Files
filename = data.txt
|
|