| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 660 人关注过本帖
标题:请教一个特菜的问题
取消只看楼主 加入收藏
rxgmoral
Rank: 1
等 级:新手上路
帖 子:45
专家分:0
注 册:2006-1-18
收藏
 问题点数:0 回复次数:2 
请教一个特菜的问题

请教一个特菜的问题
const char * a1="a";
const char * a2="b";
char * a3;
如何将a1和a2值相加赋给a3
最后a3的值为ab

谢谢:)

搜索更多相关主题的帖子: char const 相加 
2006-04-23 18:50
rxgmoral
Rank: 1
等 级:新手上路
帖 子:45
专家分:0
注 册:2006-1-18
收藏
得分:0 

#include <string.h>

const char * a1="a";
const char * a2="b";
char * a3= new char[strlen(a1)+strlen(a2)+1];
strcpy(a3,a1);
strcat(a3,a2);

为什么还那么多的警告呢??
如下:
e:\备份程序库\studio\infoengine\infoengine\infoengine.cpp(153) : warning C4996: 'strcpy' was declared deprecated
d:\microsoft visual studio\vc\include\string.h(73) : see declaration of 'strcpy'
Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
e:\备份程序库\studio\infoengine\infoengine\infoengine.cpp(154) : warning C4996: 'strcat' was declared deprecated
d:\microsoft visual studio\vc\include\string.h(78) : see declaration of 'strcat'
Message: 'This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'

谢谢:)

2006-04-24 15:42
rxgmoral
Rank: 1
等 级:新手上路
帖 子:45
专家分:0
注 册:2006-1-18
收藏
得分:0 

谢谢:)

2006-04-25 10:21
快速回复:请教一个特菜的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015886 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved