vc 类型转换


int  temp=66;
str.Format("%d",temp);
GetDlgItem(IDC_EDIT1)->SetWindowText(str);

cstring ---->char*
					CString   str="hello"; 
					char   *pChar=str.GetBuffer(str.GetLength()); 
					TRACE("%s",pChar);

cstring---->float 
					CString   str="12.3"; 
					char   *pChar=str.GetBuffer(str.GetLength()); 
					float   fRetVal=atof(pChar);
					TRACE("%f",fRetVal);

char* or char[] --->cstring
    char *psText;
    psText = new char[dwNum];
    CString str_return;
    str_return.Format("%s",psText);

//或直接
  str_return=psText;

16进制的字符串转化成数字
比如字符串"1F"转换成数字31
用格式化输入scanf

        CString str_tmp="1f"
        int i_value;
        sscanf(str_tmp,"%x",&i_value);  
        Trace("%x",i_value);
如果是转化成10进制的就用aoti即可  i_ID=atoi(str_ID);

你可能感兴趣的:(float)