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

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -