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

https://www.cnblogs.com/just-like-this/p/11893293.html

CodePudding user response:

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,

CodePudding user response:

reference 4 floor 丁劲犇 response:
the scanf can lead to a buffer overflow, and similar all functions related to string have 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,
understand understand, is too strong, ha ha ha ha??

CodePudding user response:

reference 4 floor 丁劲犇 response:
the scanf can lead to a buffer overflow, and similar all functions related to string have 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,
?? , thank you ah, hee hee

CodePudding user response:

Fun
reference 3 floor 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

Solutions have to tell you in front of the
thank you ah, hee hee
  • Related