本文整理汇总了C++中OString::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ OString::c_str方法的具体用法?C++ OString::c_str怎么用?C++ OString::c_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OString
的用法示例。
在下文中一共展示了OString::c_str方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetLocalTime
static void
message_element_init(MessageQueueElement *el,
const char *function_name,
void *bt_address,
DWORD resource_id,
MessageType msg_type)
{
/* timestamp */
GetLocalTime(&el->time);
/* process name, id and thread id */
get_process_name(el->process_name, sizeof(el->process_name));
el->process_id = GetCurrentProcessId();
el->thread_id = GetCurrentThreadId();
/* function name and return address */
strncpy(el->function_name, function_name, sizeof(el->function_name));
if (bt_address != NULL)
{
OString backtrace = Util::Instance()->CreateBacktrace(bt_address);
strncpy(el->backtrace, backtrace.c_str(), sizeof(el->backtrace));
el->backtrace[sizeof(el->backtrace) - 1] = '\0';
}
/* underlying resource id */
if (resource_id == 0)
{
resource_id = ospy_rand();
}
el->resource_id = resource_id;
/* message type */
el->type = msg_type;
}
示例2: Error
DllModule::DllModule(const OString &path)
: m_path(path)
{
m_handle = LoadLibraryA(path.c_str());
if (m_handle == NULL)
throw Error("LoadLibrary failed");
char tmp[_MAX_PATH];
if (GetModuleBaseNameA(GetCurrentProcess(), m_handle, tmp, sizeof(tmp)) == 0)
throw Error("GetModuleBaseName failed");
m_name = tmp;
OModuleInfo mi = Util::Instance()->GetModuleInfo(m_name.c_str());
m_base = reinterpret_cast<void *>(mi.startAddress);
m_size = mi.endAddress - mi.startAddress;
}