本文整理汇总了C++中Pathname::IsNetworkPath方法的典型用法代码示例。如果您正苦于以下问题:C++ Pathname::IsNetworkPath方法的具体用法?C++ Pathname::IsNetworkPath怎么用?C++ Pathname::IsNetworkPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pathname
的用法示例。
在下文中一共展示了Pathname::IsNetworkPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RelativeToFull
bool Pathname::RelativeToFull(const Pathname &ref)
{
if (ref.IsNull() || IsNull()) return false;
const char *beg;
if (HasDrive())
if (toupper(GetDrive()) != toupper(ref.GetDrive())) return false;
else beg = _path+2;
else beg = _path;
const char *end = strchr(ref._path,0);
if (beg[0] =='\\')
{
int np;
if (ref.HasDrive()) end = ref._path+2;
else if (np = ref.IsNetworkPath()) end = ref._path+np;
else end = ref._path;
}
else while (strncmp(beg,"..\\",3) == 0 || strncmp(beg,".\\",2) == 0)
{
if (beg[1] =='.')
{
if (end>ref._path)
{
end--;
while (end>ref._path && end[-1]!='\\') end--;
}
beg += 3;
}
else
beg += 2;
}
int partln = end-ref._path;
char *buff = (char *)alloca((partln+strlen(beg)+1)*sizeof(*buff));
memcpy(buff,ref._path,partln);
strcpy(buff+partln,beg);
SetDrive(0);
SetDirectory(buff);
return true;
}