断断几行代码~!·~·~·~··~~·~~~·~··~~·哪里错了?谢谢。。。回答了得5分:物超所值~!~!·~!~

TemplatesGuy 2005-03-27 09:29:26
#include<iostream>
#include<cstring>
#include<string>

using namespace std;
int main()
{
cout<<"_______Main() Start_______"<<endl;
wchar_t *str;
str=new wchar_t[4];
wcscpy(str,"c++");
delete [] str;
cout<<"_____End Main()________"<<endl;
}
...全文
124 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
EnochShen 2005-03-28
  • 打赏
  • 举报
回复
昏,第一次为了5分回复2次.ostream是byte stream

cout<< (char*)str<<endl;
TemplatesGuy 2005-03-28
  • 打赏
  • 举报
回复
@EnochShen(小疯子:真的好菜—知耻而后勇!)
-----------------------
错了。我使用了下面的代码:

#include<iostream>
#include<cstring>
#include<string>

using namespace std;
int main()
{
cout<<"_______Main() Start_______"<<endl;
wchar_t *str;
str=new wchar_t[4];
//wcscpy(str,"c++");
wcscpy(str,(wchar_t *)"c++\0");
cout<< str<<endl; ///////////////////////这行错了,没有输出字符“C++”
delete [] str;
cout<<"_____End Main()________"<<endl;
}

TemplatesGuy 2005-03-28
  • 打赏
  • 举报
回复
@ whs1980(知秋一叶)
-----------------
谢谢。错了,

我是用了下面的代码,提示的错误是一样的:

==================
#include<iostream>
#include<string>
#define UNICODE
#include<TCHAR.H>

using namespace std;

int main()
{
cout<<_TEXT("_______Main() Start_______")<<endl;
wchar_t *str;
str=new wchar_t[4];
wcscpy(str,_TEXT("c++"));
cout<< str<<endl;
delete [] str;
cout<<_TEXT("_____End Main()________")<<endl;
return 0;
}
yalechenfly 2005-03-28
  • 打赏
  • 举报
回复
我查了一下MSDN,知道其大概意思了,不过这是在
STDDEF.H, STDLIB.H中declared,是否要included
yalechenfly 2005-03-28
  • 打赏
  • 举报
回复
wchar_t *str;
str=new wchar_t[4];
wcscpy(str,"c++");
请问这三行什么意思?
wchar_t是什么数据格式?
菜牛 2005-03-28
  • 打赏
  • 举报
回复
加上我6个,5分不好平分了。
nilliu 2005-03-27
  • 打赏
  • 举报
回复
wcscpy(str,"c++");
格式转换有误

EnochShen 2005-03-27
  • 打赏
  • 举报
回复
wcscpy(str,(wchar_t *)"c++\0");
whs1980 2005-03-27
  • 打赏
  • 举报
回复
最后还有一个:
return TRUE;
whs1980 2005-03-27
  • 打赏
  • 举报
回复
#include<iostream>
#include<cstring>
#include<string>
#define UNICODE
int main()
{
cout<<_TEXT("_______Main() Start_______")<<endl;
wchar_t *str;
str=new wchar_t[4];
wcscpy(str,_TEXT("c++"));
delete [] str;
cout<<_TEXT("_____End Main()________")<<endl;
}
楼主,是这个意思吗?
不晓得你想干什么,随便改了
4inSky 2005-03-27
  • 打赏
  • 举报
回复
main函数需要返回值,
最后一行加个return 1;

16,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧