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

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

ExpandUNCFileName

unit
Sysutils
category
file name utilities

declaration
function ExpandUNCFileName(const S: FileName): string;

description
Retrieves the full path and filename of a specified (relative) file using Universal Naming Convention for network files.

ExpandUNCFileName returns a fully qualified path name using Universal Naming Convention for network files. For files on local disks, ExpandUNCFileName is equivalent to ExpandFileName.
In a UNC file name, the drive prefix is replaced with the name of the network resource to which the drive is mapped. For example, if the working directory is G:\SomeSharedFolder and drive G is mapped to \\CompanyServer\AllSharedFolders ExpandUNCFileName('afile.ext') returns "\\CompanyServer\AllSharedFolders\SomeSharedFolder\afile.ext".

example

ShowMessage(ExpandUNCFileName('afile.ext'));

//displays "\\CompanyServer\AllSharedFolders\SomeSharedFolder\afile.ext"
//if the working directory is G:\SomeSharedFolder 
//and drive G is mapped to "\\CompanyServer\AllSharedFolders"

in real code
Network programming
Working with network connections from Delphi.

TNetDrive
TNetDrive is a non-visual component that connects a network path to a drive name. Full source code.

see also
ExpandFileName, 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?
Explore Delphi Programming
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2009 About.com, a part of The New York Times Company.

All rights reserved.