c语言 vs2013 安全检查
2015-04-07 19:52
274 查看
今天学习到了字符串和字符串函数
源码
#include <stdio.h>
//#define _CRT_SECURE_NO_WARNINGS
#define MSG "You must have many talents.Tell me some."//一个符号字符号常量
#define LIM 5
#define LINELEN 81
int main(void)
{
char name[LINELEN];
char talents[LINELEN];
int i;
const char m1[40] = "Limit yourself to one line's worth.";
const char m2[] = "If you can't think of anything. fake it.";
const char *m3 = "\nEnough about me - what's your name?";
const char *mytal[LIM] = { "Adding numbers swiftly",
"Multiplying accurately", "Stashing data",
"Following instructions to the letter",
"Understanding the C language" };
printf("Hi! I'm Clyde the Computer.""I have many talents.\n");
printf("Let me tell you some of them.\n");
puts("What's were they? Ah, yes, here's a partial list.");
for (i = 0; i < LIM; i++)
puts(mytal[i]);
puts(m3);
gets(name);
printf("Well, %s, %s\n", name, MSG);
printf("%s\n%s\n", m1, m2);
gets(talents);
puts("Let's see if I've got that list:");
puts(talents);
printf("Thanks for the information, %s.\n", name);
getchar();
return 0;
}
这样的代码在VS2013中是错误的,必须加上#define _CRT_SECURE_NO_WARNINGS而且必须加在代码的最顶端 不然还是会报错。
今天看到一句话是一位教授说,对于一种编程语言当你敲了十万行有效执行代码的时候你才算精通了这门语言,三万行算是熟悉这门语言了,受教啊。还差的很远呢。
源码
#include <stdio.h>
//#define _CRT_SECURE_NO_WARNINGS
#define MSG "You must have many talents.Tell me some."//一个符号字符号常量
#define LIM 5
#define LINELEN 81
int main(void)
{
char name[LINELEN];
char talents[LINELEN];
int i;
const char m1[40] = "Limit yourself to one line's worth.";
const char m2[] = "If you can't think of anything. fake it.";
const char *m3 = "\nEnough about me - what's your name?";
const char *mytal[LIM] = { "Adding numbers swiftly",
"Multiplying accurately", "Stashing data",
"Following instructions to the letter",
"Understanding the C language" };
printf("Hi! I'm Clyde the Computer.""I have many talents.\n");
printf("Let me tell you some of them.\n");
puts("What's were they? Ah, yes, here's a partial list.");
for (i = 0; i < LIM; i++)
puts(mytal[i]);
puts(m3);
gets(name);
printf("Well, %s, %s\n", name, MSG);
printf("%s\n%s\n", m1, m2);
gets(talents);
puts("Let's see if I've got that list:");
puts(talents);
printf("Thanks for the information, %s.\n", name);
getchar();
return 0;
}
这样的代码在VS2013中是错误的,必须加上#define _CRT_SECURE_NO_WARNINGS而且必须加在代码的最顶端 不然还是会报错。
今天看到一句话是一位教授说,对于一种编程语言当你敲了十万行有效执行代码的时候你才算精通了这门语言,三万行算是熟悉这门语言了,受教啊。还差的很远呢。
相关文章推荐
- VS2013使用教程总结(1)---忽略安全检查
- vs2013关闭安全函数检查
- VS2013 C++ 关闭安全检查
- 新手系列VS2013---C语言"金字塔图案"
- vs2013或2012运行c语言出现:无法查找或打开 PDB 文件,解决方法
- vs解决无符号类型,安全开发生命周期(SDL)检查
- VS2013中scanf,print不安全
- vs2013遇到fopen不安全替换fopen_s的问题
- vs2013 C语言设置
- VS2013使用C语言实现数字图像处理基础(1)
- 怎样解决VS2013模块对于SAFESEH 映像是不安全的
- VS2013模块对于SAFESEH映像是不安全的解决方法
- VS2013 C语言(C++)连接linux的MySQL服务器
- vs2013运行c语言出现:无法查找或打开 PDB 文件。
- C语言学习-vs2013编译器问题
- 用vs2013编写C语言与编写C++的区别
- vs2013运行c语言出现:无法查找或打开 PDB 文件。
- 在用vs2013时,遇到的报因函数不安全的错误
- VS2013:error LNK2026: 模块对于 SAFESEH 映像是不安全的
- VS2013模块对于SAFESEH 映像是不安全的