I’m using sprintf(newpath, "%s%s", cCurrentPath, "\\init.scm"); to add \init.scm to current dir path but there is the usual warning:
warning C4996: 'sprintf': This function or variable may be unsafe.
Consider using sprintf_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS.
Sprintf_s doesn’t support such “%s%s” string sum. How can I do it using sprintf_s?
sprintf_sis basically the same assprintf, but it gets another parameter:Note – if
newpathis a normal character array,sizeof(newpath)works. If it’s a pointer or an array passed as an argument, you may need a different way to get the size.You can also use
snprintffor the same purpose in a non-MS environment (though it works differently).