c++ - 如何比较 strstr(LPCWSTR, CHAR*);

标签 c++ c winapi visual-c++

LPCWSTR location_url;
m_spWebBrowser->get_LocationURL((BSTR*)&location_url);

如何比较 strstr 中的 LPCWSTRconst char *

示例:

if(strstr((location_url, ".html"))

最佳答案

您也可以将目标扩展名设置为宽字符串并使用 wcsstr

wchar_t* ext = L".html";
if (wcsstr(location_url, ext))

关于c++ - 如何比较 strstr(LPCWSTR, CHAR*);,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13249606/

相关文章:

c++ - 使用模板作为模板函数参数

c - 使用 C 中的简单数组示例递减和递增

c - 如何调用WM_SETREDRAW?

c# - 自动化 Windows GUI 测试 - FindWindowEx 和控制类

C++模板问题

c++ - Windows 7 中的滚动条外观控制

c++ - 需要确定一个矩阵来对齐两个三角形

c - 读取 Arduino Uno 上的引脚不起作用,需要有关 avr-gcc 的帮助

c - 用 C 语言中另一个字符串中的字符替换字符串字符

c++ - 需要对 "High definition time-stamps"(win32、direct3d、性能计数器)进行一些说明