Hello.
I have problem.
Program works with code:
1 2 3 4 5 6
|
string nameF = "";
cin >> nameF;
char* nameFC = (char*)malloc( sizeof( char ) *(nameF.length() +1) );
strcpy(nameFC, nameF.c_str());
cout << "char* == " << nameFC << endl;
|
but if i want to use function whose i write
1 2 3 4 5 6 7 8
|
char* nameFC = (char*)malloc( sizeof( char ) *(nameF.length() +1) );
strcpy(nameFC, nameF.c_str());
cout << "char* == " << nameFC << endl;
//my funciton(char* text)
//my function work good if i use
// char* nameFC = "text";
setText(nameFC);
|
i have error
warning C4996: 'strcpy': This function or variable may be unsafe.
Last edited on
I have used before strncpy(), but i have this same error.
C4996 can always be safely ignored.
#pragma warning(disable:4996)