没办法上传图片 只能发内容了
getname()申请数组长度200 在main()函数输出乱码 但是在申请长度2000 可以正常输出"hello world"
char * getname();int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
char *name=getname();
cout<<name<<endl; // 初始化 MFC 并在失败时显示错误
system("pause");
return nRetCode;
}
char * getname()
{
char ch[200]={0};
strcpy_s(ch,"hello world");
return ch;
}
getname()申请数组长度200 在main()函数输出乱码 但是在申请长度2000 可以正常输出"hello world"
char * getname();int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
char *name=getname();
cout<<name<<endl; // 初始化 MFC 并在失败时显示错误
system("pause");
return nRetCode;
}
char * getname()
{
char ch[200]={0};
strcpy_s(ch,"hello world");
return ch;
}
解决方案 »
- 帮忙看下出错在哪里
- 这个问题比较难:如何捕获WebBrowser Control或CHtmView 的HTTP回应头数据?希望大家指条明路!
- SDI程序中,重绘视图时,如何让它先停止重绘,做其他的事,做完后再接着重绘?
- 求助:CListCtrl设置LVS_EX_GRIDLINES之后网格不能正确显示
- 请问你们都在哪个网站上买书的?第二书店里买书没有货到付款的购买方式``不方便啊``
- OWNER_DRAW 组合框问题,请帮忙。
- 相同功能的C函数和API有什么区别?
- 为什么用NotifyIcon()在任务栏添加的图标会消失?
- 我用CAsyncSocket编通信时,我检验了server端的SEND函数(用GETLASTERROR()),发现出现10038错误,请问这是什么错误
- 怎么给分呀?我是菜鸟
- 如何在WTL中的修改ListViewCtrl中某一行字体的颜色
- CTootipCtrl弹出的tootip被遮挡
char * getname()
{
char ch[200]={0};
strcpy_s(ch,"hello world");
return ch;
}基础知识,不要返回一个局部变量指针.
{strcpy_s(ch,"hello world");
return 1;;
}