64,282
社区成员
发帖
与我相关
我的任务
分享
CString strPathName = "F:\\1\\CT-MONO2-8-abdo.dcm";
//(LPSTR)(LPCTSTR)是一种不安全的强制类型转换,CString本生定义了转换函数LPCTSTR()
//LPCTSTR 是const类型的,CString只能跟LPCTSTR直接转化
//char *str =(LPSTR)(LPCTSTR)strPathName;
char * str = strPathName.GetBuffer(0);
...
//通过str指针对strPathName内容操作
...
strPathName.ReleaseBuffer();
char* str = strPathName.GetBuffer()
char* str;
str=(char*)malloc(sizeof(char)*strlen(strPathName));
strcpy(str,strPathName);