Search code examples
c++stringwchar-t

Comparing 2 wchar_t arrays


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.

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";

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

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

Thanks


Solution

  • Use a std::wstring, it has an operator==.