I do not see my error here, would someone please be kind enough point it out to me and explain what I am doing wrong and how I fix it?
Thanks so much!
I am getting the following errors..
Error 1 error C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. Line 31
Error 2 error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion) Line 84
Error 3 IntelliSense: no operator "<<" matches these operands
operand types are: std::basic_ostream<char, std::char_traits<char>> << std::string Line 84
You must be using Visual Studio. I use it, and it yells at me from time to time.
Microsoft deprecated strncpy (it is a source of buffer overflow) and replaced it with strncpy_s.
You can either change to strncpy_s or do something like this
I added the #include <string> and it seemed to fix my line 84 issue. Now I am getting an error on line 33 (which is line 31 above) that states..
Error 1 error C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. Line 33
Ah, ok. strncpy_s takes 4 arguments instead of 3.
You can call it like this: strncpy(destinationString, destinationStringSize, sourceString, sourceStringSize);
destinationString is the new string, and destinationStringSize is the size of the new string.
sourceString is the original string (the one to be copied), and sourceStringSize is the size of the original string.
I really hate it when they deprecate functions. Strncpy is deprecated by Microsoft, but not by ISO.