本文整理汇总了C++中VString::postflight方法的典型用法代码示例。如果您正苦于以下问题:C++ VString::postflight方法的具体用法?C++ VString::postflight怎么用?C++ VString::postflight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VString
的用法示例。
在下文中一共展示了VString::postflight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _platform_getExecutable
// static
VFSNode VFSNode::_platform_getExecutable() {
const int PATH_BUFFER_SIZE = 1024;
VString executablePath;
executablePath.preflight(PATH_BUFFER_SIZE);
ssize_t len = ::readlink(PROCESS_LINKPATH, executablePath.buffer(), PATH_BUFFER_SIZE - 1);
if (len == -1) {
throw VStackTraceException(VSystemError(), "VFSNode::_platform_getExecutable: Unable to determine executable path.");
}
executablePath.postflight(len);
return VFSNode(VFSNode::normalizePath(executablePath)); // must supply normalized form to VFSNode below
}
示例2: _platform_addrinfoToIPAddressString
// static
VString VSocket::_platform_addrinfoToIPAddressString(const VString& hostName, const struct addrinfo* info) {
void* addr;
if (info->ai_family == AF_INET) {
addr = (void*) &(((struct sockaddr_in*)info->ai_addr)->sin_addr);
} else if (info->ai_family == AF_INET6) {
addr = (void*) &(((struct sockaddr_in6*)info->ai_addr)->sin6_addr);
} else {
// We don't know how to access the addr for other family types. They could conceivably be added.
throw VException(VSTRING_FORMAT("VSocket::_platform_addrinfoToIPAddressString(%s): An invalid family (%d) other than AF_INET or AF_INET6 was specified.", hostName.chars(), info->ai_family));
}
VString result;
result.preflight(MAX_ADDRSTRLEN);
const char* buf = ::inet_ntop(info->ai_family, addr, result.buffer(), MAX_ADDRSTRLEN);
if (buf == NULL) {
throw VException(VSystemError::getSocketError(), VSTRING_FORMAT("VSocket::_platform_addrinfoToIPAddressString(%s): inet_ntop() failed.", hostName.chars()));
}
result.postflight((int) ::strlen(buf));
return result;
}