PathRemoveFileSpec (shlwapi)
Last changed: pdellera-24.5.99.244

.
Summary
Removes the trailing file name and backslash from a path, if it has them.

C# Signature:

[DllImport("shlwapi.dll", CharSet=CharSet.Auto)]
static extern bool PathRemoveFileSpec([In,Out] StringBuilder pszPath);

VB Signature:

Declare Function PathRemoveFileSpec Lib "shlwapi.dll" (TODO) As TODO

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

StringBuilder str = new StringBuilder(@"C:\TEST\sample.txt");
bool bRet = PathRemoveFileSpec(str);
// Result: bRet == true && str.ToString() == @"C:\TEST"

Alternative Managed API:

Do you know one? Please contribute it!

Documentation