当前位置:网站首页>关于VS scanf出现‘scanf‘: This function or variable may be unsafe. Consider usi问题的解决方法
关于VS scanf出现‘scanf‘: This function or variable may be unsafe. Consider usi问题的解决方法
2022-06-26 00:13:00 【原来是这样^^】
方法一:也是最简单的,将scanf改为scanf_s就可以使用
虽然这样可以解决问题,但并不建议这样子做,原因是scanf_s不是c语言自己的,它只能在vs这个编译器里可以正常使用,在其它编译器里是不认scanf_s这个函数的,代码的移植性将大大削弱。
方法二:在第一行,注意,是第一行引入
#define _CRT_SECURE_NO_DEPRECATE即可
这样我们就可以用c语言自带的scanf啦。
这样其实也有一个弊端,就是我们每创建一个新项目就要重新添加这句话太麻烦了,我们可不可以以后一创建新项目它就自动在第一行就打出#define _CRT_SECURE_NO_DEPRECATE这句话呢,答案是可以的
1.下载一个名为《Everything》的软件,这是一款用于搜索文件名和文件位置的软件
2.然后打开《Everything》软件,搜索newc++file.cpp

鼠标右键打开路径

将它脱出桌面,右键编辑把上面那句#define _CRT_SECURE_NO_DEPRECATE写在文本第一行


3.将桌面的那个拖回到路径里面去,有的是复制回去,有的是直接放回去,效果一样

新建一个项目会发现他会自动打出#define _CRT_SECURE_NO_DEPRECATE

完成
边栏推荐
猜你喜欢

Show spirit chenzitong was invited to be the chief experience officer of the global finals of the sixth season perfect children's model

论文阅读 Exploring Temporal Information for Dynamic Network Embedding

21. Hoff circle transformation

28. contour discovery

蒟蒻初学单片机的一丢丢笔记

The answer skills and examples of practical cases of the second construction company are full of essence

Pixel6 unlock bootloader

CyCa children's physical etiquette Yueqing City training results assessment successfully concluded

二造实务案例答题技巧和举例汇总,满满都是精髓

秀场精灵陈梓桐 受邀担任第六季完美童模全球总决赛首席体验官
随机推荐
如何为政企移动办公加上一道“安全锁”?
How to search papers in a certain field
"Hot post" Statistics
Talking about interface test (I)
二造实务案例答题技巧和举例汇总,满满都是精髓
Energetic girl wangyujie was invited to be the spokesperson for the global finals of the sixth season perfect children's model
Log4j2 vulnerability
Difference between app test and web test
easyexcel读取文件
Can bus transceiver principle
从在浏览器的输入框输入一个网址,到看到网页的内容,这个过程中发生了什么?
Common deep learning optimizers
Some summary of sequence model
21. Hoff circle transformation
[visual studio code] vscode shortcut keys
OTA trigger
wifi 的理论速度计算方法
Web Testing
--SQL of urban cultivation manual -- Chapter 1 basic review
Cross validation -- a story that cannot be explained clearly