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")]
public static extern Int32 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);

Int32 nRet = PathRemoveFileSpec(str);

// Result: nRet != 0 && str.ToString() == @"C:\TEST

Alternative Managed API:

Do you know one? Please contribute it!

Documentation