请教一个特菜的问题
const char * a1="a";
const char * a2="b";
char * a3;
如何将a1和a2值相加赋给a3
最后a3的值为ab
谢谢:)
请教一个特菜的问题
const char * a1="a";
const char * a2="b";
char * a3;
如何将a1和a2值相加赋给a3
最后a3的值为ab
谢谢:)
 2006-04-23 18:50
	    2006-04-23 18:50
   2006-04-24 11:12
	    2006-04-24 11:12
  
 2006-04-24 14:33
	    2006-04-24 14:33
  #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
	    2006-04-24 15:42
  #include <string.h>
#include <stdio.h>
main()
{
const char * a1="a";
const char * a2="b";
char * a3= new char[strlen(a1)+strlen(a2)+1];
strcpy(a3,a1);
strcat(a3,a2);
printf("%s\n",a3);
return 0;
}
没有问题啊
 2006-04-25 01:19
	    2006-04-25 01:19
  谢谢:)
 2006-04-25 10:21
	    2006-04-25 10:21