检测路径是绝对路径还是相对路径 [英] Detect whether path is absolute or relative
本文介绍了检测路径是绝对路径还是相对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用C ++,我需要检测给定的路径(文件名)是绝对的还是相对的。我可以使用Windows API,但不想使用Boost的第三方库,因为我需要这个解决方案在小的Windows应用程序没有经验的依赖。
Using C++, I need to detect whether given path (file name) is absolute or relative. I can use Windows API, but don't want to use third-party libraries like Boost, since I need this solution in small Windows application without expernal dependencies.
推荐答案
Windows API具有 PathIsRelative
。它定义为:
The Windows API has PathIsRelative
. It is defined as:
BOOL PathIsRelative(
_In_ LPCTSTR lpszPath
);
这篇关于检测路径是绝对路径还是相对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文