Visual Studio函数被警告安全,如何修改

1.今天使用 _itoa函数,出现蛋疼的问题原来又是微软的一套。

 

 

2.如何解决呢?

在第一行添一句:#define _CRT_SECURE_NO_WARNINGS    //关闭安全检查

代码如下:

 1 #define _CRT_SECURE_NO_WARNINGS
 2 # include<stdio.h>
 3 # include<stdlib.h>
 4 int main()
 5 {
 6     int num = 65543;
 7 
 8     printf("十进制为 = %d,十六进制为 = %x,八进制为 = %o\n", num, num, num);
 9 
10     char str[32];
11     _itoa(num, str, 2);
12 
13     printf("二进制为 = %s", str);
14 
15     getchar();
16 }
View Code

 

posted @ 2014-11-05 20:42  天天AC  阅读(719)  评论(0编辑  收藏  举报