c++ - Trouble with strcpy function -


i have user defined class, 1 of members char* type. when try initialize in constructor error saying error c4996: 'strcpy': function or variable may unsafe. consider using strcpy_s instead.

however, when changed strcpy strcpy_s, still give following error intellisense: no instance of overloaded function "strcpy_s" matches argument list argument types are: (char *, char *)

let's student class , char* name; 1 of data members.so, constructor like:

student (char* s = null) {     if (s != null) {          name = new char[strlen(s) + 1];          //strcpy(name,s);          strcpy_s(name,s);     }  } 

it's because strcpy_s requires additional parameter specify how many bytes copy.

see here: http://www.cplusplus.com/forum/beginner/118771/


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -