码迷,mamicode.com
首页 >  
搜索关键字:strcpy_s    ( 952个结果
strcpy,strlen,strcmp实现
1.strcpy的实现char * my_strcpy(char * s1, char * s2){ assert(s1 != NULL&&s2 != NULL); char *res = s1; while ((*(res++) = *(s2++))!='\0'); ret...
分类:其他好文   时间:2015-06-14 22:33:01    阅读次数:133
eclipse+CDT调试segmentation fault错误
先来看两段代码-- 错误代码: #include "string.h" #include #include void test(char ** dest, char * src, int n) { (*dest) = (char*) malloc(sizeof(char) * n); strcpy(*dest, src); } int main(int argc, char** a...
分类:系统相关   时间:2015-06-13 17:10:41    阅读次数:211
strcpy_s与strcpy对照
strcpy_s和strcpy()函数功能几乎相同。strcpy函数。就象gets函数一样,它没有方法来保证有效的缓冲区尺寸,所以它仅仅能假定缓冲足够大来容纳要拷贝的字符串。在程序执行时,这将导致不可预料的行为。用strcpy_s就能够避免这些不可预料的行为。这个函数用两个參数、三个參数都能够,仅仅...
分类:其他好文   时间:2015-06-11 22:38:44    阅读次数:147
C++入门程序作业2
程序在Dev-C++5.5.3版本运行结构体的使用给结构体赋值,打印出结构体中学生姓名,分数,平均分#include #include #include #include #include //不用.h的话可能下面的strcpy用不了 #include using namespace std; i....
分类:编程语言   时间:2015-06-09 11:34:45    阅读次数:153
C语言中的字符数组
周末赶数据结构的作业,整理的一些关于C语言中字符数组的困惑与解答。1.赋值C语言中,给字符数组char s[]赋值使用strcpy (在string.h头文件中)#include #include int main(){ char test[3][4]; strcpy(test[0], "abc")...
分类:编程语言   时间:2015-06-08 11:13:59    阅读次数:200
自己实现的字符串长度求取、复制、连接
int strlen(char* s){ int ret = 0; while(*s != 0) { ret++; *s++; } return ret;}char* strcpy(char* dest, char* src){ cha...
分类:其他好文   时间:2015-06-07 21:28:49    阅读次数:114
【c++】浅拷贝成功__count解决
#include #include using namespace std; class String { public: String(const char *str = " ") { m_data = new char[strlen(str) + 1]; strcpy(m_data, str); count++; } String(const String &s) ...
分类:编程语言   时间:2015-06-05 22:49:07    阅读次数:162
【c++】异常安全深赋值
// 深拷贝,异常安全的深赋值 #include #include using namespace std; class String { public: String(const char *str = " ") { m_data = new char[strlen(str) + 1]; strcpy(m_data, str); } String(const String...
分类:编程语言   时间:2015-06-05 17:32:26    阅读次数:144
strcpy函数的实现
大家一般觉得名不见经传strcpy函数实现不是非常难,流行的strcpy函数写法是:char *my_strcpy(char *dst,const char *src){ assert(dst != NULL); assert(src != NULL); char *ret = dst; while...
分类:其他好文   时间:2015-06-04 19:00:57    阅读次数:127
Buffer Over Flow Vulnerability
记录一个简单的栈溢出的实例,具体的分析以后加进去。 程序源代码buffer.c: #include #include void fun1(char *input) { char buffer[10]; strcpy(buffer,input); printf("Call fun1,buffer=%s...
分类:其他好文   时间:2015-06-03 11:37:55    阅读次数:93
952条   上一页 1 ... 65 66 67 68 69 ... 96 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!