比较2个wchar_t数组 [英] Comparing 2 wchar_t arrays

查看:117
本文介绍了比较2个wchar_t数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我敢肯定这太简单了,但是我来自C#背景,字符串很简单,现在我要进入一个不受管理的世界,这让我很困惑.

I'm sure this is sooo simple but I've come from a c# background where strings are easy and now I am making a small trip into the unmanaged world I am very confused.

基本上,我正在使用EnumDisplayDevices列出可用的设备,我想针对特定的适配器,因此我需要将DeviceString和DeviceName与一些已知值进行比较,以查看我是否有合适的适配器来工作.

Essentially I am using EnumDisplayDevices to list the available devices, I want to target a particular adapter so I need to compare DeviceString and DeviceName against some know values to see whether or not I have the right adapter to work on.

但是我很困惑,我将已知值定义为……

But I am stumped, I defined the known value as such...

wchar_t devName[] = L"Intel(R) HD Graphics Family";

但是直接比较不起作用- if(devName == theDisplay.DeviceName)

but direct comparison doesn't work - if(devName == theDisplay.DeviceName)

strcmp 似乎不适用于宽字符,所以我不知道该怎么做,有人知道该怎么做吗?

strcmp doesnt seem to work with wide chars so I have no idea what to do, anyone know how to do this please?

谢谢

推荐答案

使用 std :: wstring ,它具有 operator == .

这篇关于比较2个wchar_t数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆