vc2008 CString转成char*出错, 如何解决 20
voidDOOK_Action(char*dialog_rename,char*component,ProAppDatadata){ProErrorstatus;//检测...
void DOOK_Action(char *dialog_rename, char *component, ProAppData data)
{
ProError status; //检测错误
wchar_t* new_name_frist; //宽字符指针
wchar_t* new_name;
wchar_t* xiahua;
char* char_new_name_frist; //普通字符指针
char* char_xiahua;
char* char_new_name;
ProMdl solid_mdl; //模型名称变量
ProMdl model;
ProMdl *session_mdls;//模型名称变量指针
ProMdlType mdl_type;//模型类型变量
int arr_size;
int w_id;
ProName *File_name; //模型名称变量指针
char **names;
wchar_t **labels;
CString test,aa; //测试用类定义,可在运行时检测结果// string str;
char_xiahua="_";
ProStringToWstring(xiahua,char_xiahua);
//获得输入框之值
status=ProUIInputpanelValueGet(dialog_rename,"insert",&new_name_frist);
ProWstringToString(char_new_name_frist,new_name_frist);
aa=char_new_name_frist;
status=ProSessionMdlList (PRO_MDL_PART, &session_mdls, &arr_size);//获得当前所有零件模型句柄
//为数组分配内存
ProArrayAlloc (arr_size, sizeof(char *),1,(ProArray*)&names);
ProArrayAlloc (arr_size, sizeof(wchar_t *),1,(ProArray*)&labels);
//数组初始化
for(int i=0;i<arr_size;i++){
labels[i]=(wchar_t*)calloc(PRO_NAME_SIZE,sizeof(wchar_t));
ProMdlNameGet(session_mdls[i],labels[i]); //得到所有模型名称
test=labels[i];
test=aa+"_"+test;
char_new_name=test.GetBuffer(test.GetLength());
ProStringToWstring(new_name,char_new_name);
}
ProSolidRegenerate((ProSolid(solid_mdl)),PRO_B_TRUE);
}
} 展开
{
ProError status; //检测错误
wchar_t* new_name_frist; //宽字符指针
wchar_t* new_name;
wchar_t* xiahua;
char* char_new_name_frist; //普通字符指针
char* char_xiahua;
char* char_new_name;
ProMdl solid_mdl; //模型名称变量
ProMdl model;
ProMdl *session_mdls;//模型名称变量指针
ProMdlType mdl_type;//模型类型变量
int arr_size;
int w_id;
ProName *File_name; //模型名称变量指针
char **names;
wchar_t **labels;
CString test,aa; //测试用类定义,可在运行时检测结果// string str;
char_xiahua="_";
ProStringToWstring(xiahua,char_xiahua);
//获得输入框之值
status=ProUIInputpanelValueGet(dialog_rename,"insert",&new_name_frist);
ProWstringToString(char_new_name_frist,new_name_frist);
aa=char_new_name_frist;
status=ProSessionMdlList (PRO_MDL_PART, &session_mdls, &arr_size);//获得当前所有零件模型句柄
//为数组分配内存
ProArrayAlloc (arr_size, sizeof(char *),1,(ProArray*)&names);
ProArrayAlloc (arr_size, sizeof(wchar_t *),1,(ProArray*)&labels);
//数组初始化
for(int i=0;i<arr_size;i++){
labels[i]=(wchar_t*)calloc(PRO_NAME_SIZE,sizeof(wchar_t));
ProMdlNameGet(session_mdls[i],labels[i]); //得到所有模型名称
test=labels[i];
test=aa+"_"+test;
char_new_name=test.GetBuffer(test.GetLength());
ProStringToWstring(new_name,char_new_name);
}
ProSolidRegenerate((ProSolid(solid_mdl)),PRO_B_TRUE);
}
} 展开
2012-10-26
展开全部
baidu "string c_str"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询