CString转int int转LPCTSTR

                //CString转化为int

                 CString strnum="123";
                 nt resultnum=-1;  
                char *pStr=(char *)strnum.GetBuffer(0);  
                sscanf(pStr,"%d",&resultnum);
                 


               //int转化为LPCTSTR

            itn reultnum=123;
             char   szBuf[4]; //int 是4个字节,而char是1个字节,所以数组大小是4
             LPCTSTR Text1;
             sprintf(szBuf,"%d",resultnum);// 歌曲序号从1开始,所以为i+1
              Text1=LPCTSTR(szBuf);
  

你可能感兴趣的:(CString转int int转LPCTSTR)