windows中目录字符串处理函数, MSDN里有使用的例子

PathSearchAndQualify Function


Determines if a given path is correctly formatted and fully qualified.

Syntax

BOOL PathSearchAndQualify(      
    LPCTSTR pcszPath,
    LPTSTR pszFullyQualifiedPath,
    UINT cchFullyQualifiedPath
);

Parameters

pcszPath
[in] Pointer to a null-terminated string of maximum length MAX_PATH that contains the path to search.
pszFullyQualifiedPath
[out] Pointer to a null-terminated string of maximum length MAX_PATH that contains the path to be referenced.
cchFullyQualifiedPath
[in] Width of the path pointed to by pszFullyQualifiedPath, in characters.

Return Value

Returns TRUE if the path is qualified, or FALSE otherwise.

PathSetDlgItemPath Function


Sets the text of a child control in a window or dialog box, using PathCompactPath to make sure the path fits in the control.

Syntax

void PathSetDlgItemPath(      
    HWND hDlg,
    int id,
    LPCSTR pszPath
);

Parameters

hDlg
[in] Handle to the dialog box or window.
id
[in] Identifier of the control.
pszPath
[in] Pointer to a null-terminated string of maximum length MAX_PATH that contains the path to set in the control.

Return Value

No return value.

PathSkipRoot Function


Parses a path, ignoring the drive letter or Universal Naming Convention (UNC) server/share path parts.

Syntax

LPTSTR PathSkipRoot(      
    LPCTSTR pszPath
);

Parameters

pszPath
[in, out] Pointer to a null-terminated string of maximum length MAX_PATH that contains the path to parse.

Return Value

Returns the address of the beginning of the subpath that follows the root (drive letter or UNC server/share).

PathUndecorate Function


Removes the decoration from a path string.

Syntax

void PathUndecorate(      
    LPTSTR pszPath
);

Parameters

pszPath
[in] Null-terminated string that contains the path. When the function returns, pszPath points to the undecorated string.

Return Value

No return value.

Remarks

A decoration consists of a pair of square brackets with one or more digits in between, inserted immediately after the base name and before the file name extension.

Example

The following table illustrates how strings are modified by PathUndecorate.

Initial StringUndecorated String
C:\Path\File[5].txtC:\Path\File.txt
C:\Path\File[12]C:\Path\File
C:\Path\File.txtC:\Path\File.txt
C:\Path\[3].txtC:\Path\[3].txt


PathStripPath Function


Removes the path portion of a fully qualified path and file.

Syntax

void PathStripPath(      
    LPTSTR pszPath
);

Parameters

pszPath
[in, out] Pointer to a null-terminated string of maximum length MAX_PATH that contains the path and file name that will have the path portion removed.

Return Value

No return value.

PathStripToRoot Function


Removes all parts of the path except for the root information.

Syntax

BOOL PathStripToRoot(      
    LPTSTR szRoot
);

Parameters

szRoot
[in, out] Pointer to a null-terminated string of maximum length MAX_PATH that contains the path to be converted.

Return Value

Returns TRUE if a valid drive letter was found in the path, or FALSE otherwise.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值