c - Crash in wcscpy_s -
i getting crash in wcscpy_s while wcscpy works fine. have following struct
struct test { ... wchar_t identity[256 * 2]; ... }; i doing member-by-member copy of 1 struct another. below 1 crashing
wcscpy_s(t2.identity, sizeof(t2.identity) , t1.identity); while 1 working fine:
wcscpy(t2.identity, t1.identity);
if read wcscpy_s reference see middle argument number of elements, while pass size of array in bytes.
if you're using visual c++ can use e.g. _countof number of elements.
Comments
Post a Comment