1. Computing & Technology
Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link Back

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit

ExpandFileName

unit
Sysutils
category
file name utilities
declaration
function ExpandFileName(const S: FileName): string;
description
Retrieves the full path and filename of a specified (relative) file.

The ExpandFileName function merges the name of the current drive and directory with the specified filename to determine the full path and filename of the specified file.
This function does not verify that the resulting path and filename are valid or that they refer to an existing file on the associated volume.

example
var AFileName, FullName : string;

AFileName  := 'myprog.exe';

ShowMessage(ExpandFileName(AFileName));
//displays 'C:\Program Files\Borland\Delphi7\Projects\myprog.exe'
// if 'C:\Program Files\Borland\Delphi7\Projects' current folder

SetCurrentDir('c:\Temp');
ShowMessage(ExpandFileName(AFileName));
//displays 'c:\Temp\myprog.exe'
in real code
Searching for Files
Stop. This is the one and only solution to file searching. Use Delphi to find any file in any directory and/or subdirectory that match a certain mask. Start searching.

Building a mp3 player
See how to build a full-blown mp3 player with Delphi in just a few seconds. Even more: get the ID3 tag information from a mp3 file and change it!

see also
ExpandUNCFileName, ExtractFileName, FileExists,


Free Delphi code snippet inside every Delphi Newsletter!
Subscribe to the Newsletter
Name
Email

Got some code to share? Got a question? Need some help?

Discuss in my forum

©2012 About.com. All rights reserved.

A part of The New York Times Company.