Getting C26485 when using strsafe.h Windows functions

47 Views Asked by At

In this simple example, I get the C26485 error when doing an analysis on the C++ code: warning C26485: Expression 'sResult2': No array to pointer decay (bounds.3).

Why is it showing on a StringCchPrintf() function when I'm passing it the size of the WCHAR array?

#include <windows.h>
#include <strsafe.h>   
WCHAR sResult2[256]{};
void GetText()
{
    StringCchPrintfW(sResult2, 256, L"this is a %s", L"test");
}

int main()
{
    GetText();
}
0

There are 0 best solutions below