Home > Back-end > Why also a string of code in vc6.0 unlike vc2019 run inside, without a mistake without warning, can
Why also a string of code in vc6.0 unlike vc2019 run inside, without a mistake without warning, can
Time:10-28
Why also a string of code in vc6.0 unlike vc2019 run inside, without a mistake without warning, can run perfect, the other can't run the scanf input something wrong, ask bosses told
CodePudding user response:
This thing because the scanf is unsafe, this function using scanf_s instead of from vs2005, refer to the following post
In your original file add # pragma warning (4996) disable:
CodePudding user response:
Because both support c + + default standard is not the same as VC6 yes old standard, VS2019 is new standard The new standard of some of the syntax and function of correction, and old code to set is wrong
In front of the solution are already tell you
CodePudding user response:
The scanf can result in buffer overflow, similar to all the functions related to string has security version, excessive character input, the program will hang, if clever arrangement, the content of the input may be able to perform a malicious script or program, scanf_s will be the size of the given string, so much input will be detected,