url提前主机

来源:互联网 发布:c语言2的n次方 编辑:程序博客网 时间:2024/04/29 14:57
bool Socket::GetHost(const char * url,char * host){try{const char * before = url;const char * pUrl= url;char * pHost= host;bool bfind = false;while (*pUrl != 0 ){if (*pUrl == '/'){const char * p = pUrl;if (p[1] == '/'){pUrl = pUrl+2;bfind = true;continue;}}if (bfind){if (*pUrl == '/'){break;}}if (bfind){*pHost=*pUrl;pHost++;}pUrl++;}}catch(...){std::cerr << "Caught exception: " <<  std::endl;}return true;}

原创粉丝点击