I have a function that sets one of the parameters to outgoing. I need to use it with std::vector.
Here is the function that returns the filename into *sFilename that is declared as WCHAR **:
BOOL GetFilenameFromPathAndFilename(WCHAR *sFilenameAndPath, WCHAR **sFilename)
{
WCHAR *pDest;
// Count backwards to find the first backslash and take the right # of chars as the filename
pDest =wcsrchr(sFilenameAndPath,'\\');
if (pDest)
{
pDest++;
DWORD dwLen = (DWORD) _tcslen(pDest) + 1;
*sFilename = (WCHAR*)calloc(dwLen, sizeof(TCHAR));
StringCchCopy(*sFilename,dwLen, pDest);
}
return (pDest != 0);
}
How do I use this function with std::vector? Using a std::vector, the call does not work:
std::vector<WCHAR> sFQDN(512);
//GetFQDomainNameEx(&sFQDN.data()); <-does not work
WCHAR *sFilenameIncoming = NULL;
GetFQDomainNameEx(&sFilenameIncoming); <-this works