#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;
}
#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;
}
最后一行加个return 1;
#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;
}
楼主,是这个意思吗?
不晓得你想干什么,随便改了
return TRUE;
格式转换有误
str=new wchar_t[4];
wcscpy(str,"c++");
请问这三行什么意思?
wchar_t是什么数据格式?
STDDEF.H, STDLIB.H中declared,是否要included
-----------------
谢谢。错了,我是用了下面的代码,提示的错误是一样的:==================
#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;
}
-----------------------
错了。我使用了下面的代码:#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;
}