argument of type "WCHAR **" is incompatible with parameter of type "const wchar_t *"

  adapter, c++, networking

I am trying to make a network utilization program that shows the current bps of an adapter. I got it all working inside main but now I want to move it out into a function I can call. I apologise in advance, I am a n00b and this is probably a basic question but when I move all the code out into a function and compile I get the following error message:

argument of type "WCHAR **" is incompatible with parameter of type "const wchar_t *"

(My code is here: It is a heavily modified version of an example I found).

long long test(WCHAR** args) {
std::cout << "running:" << args << ":End" << "n";

// Declare and initialize variables

ULONG retVal1 = 0;
ULONG retVal2 = 0;
ULONG ifIndex1;
ULONG ifIndex2;

MIB_IF_ROW2 ifRow1;
MIB_IF_ROW2 ifRow2;

// Make sure the ifRow is zeroed out
SecureZeroMemory((PVOID)&ifRow1, sizeof(MIB_IF_ROW2));

// Zero out the MIB_IF_ROW2 struct

ifIndex1 = _wtoi(args);

ifRow1.InterfaceIndex = ifIndex1;

retVal1 = GetIfEntry2(&ifRow1);

long long oct1 = PrintIfEntry2(&ifRow1);


// Make sure the ifRow is zeroed out
SecureZeroMemory((PVOID)&ifRow2, sizeof(MIB_IF_ROW2));

ifIndex2 = _wtoi(args);

ifRow2.InterfaceIndex = ifIndex2;

retVal2 = GetIfEntry2(&ifRow2);

long long oct2 = PrintIfEntry2(&ifRow2);

long long rise = (oct2 - oct1) * 8;

//rise = rise / 1000 / 1000;

return rise;


It is specifically referencing this bit of code:

ifIndex1 = _wtoi(args);

I am guessing I have gotten my casts mixed up but for the life of me I cannot see where I have gone wrong.

Any advice?

Source: Windows Questions C++