VC++的EDIT问题
本人初学,遇到个问题!!_!!
就是在一个MFC AppWizard.exe里的dialog加个EDIT框
怎么把从键盘得到的string类型的比如
1,2,3
4,5,6
6,7,8
在edit里就是这么输入的,矩阵大小不定
如何转换成内存中的int类型多维数组比如int a[3][3]
这个解析函数应该怎么写?
我胡乱写了个,但是不对
哪位大哥帮研究下,谢谢了
CString strTest1 = cInput1;
CString strNum1 , strNum12;
int nRet1,nRet2,nDot1,nEnter1=0;
nRet1 = strTest1.Find('\r' , nEnter1);
i = 0;
j = 0;
while (nRet1 !=-1)
{
strNum1 = strTest1.Mid(nEnter1,nRet1 - nEnter1);
nRet2 = strNum1.Find(',' , nDot1);
while (nRet2 != -1)
{
strNum12 = strNum1.Mid(nDot1, nRet2 - nDot1);
Allocation[i][j] = atoi(strNum12);
nDot1 = nRet2 + 1;
nRet2 = strNum1.Find(',' , nDot1);
j++;
}
strNum12 = strNum1.Right (strNum1.GetLength() - nDot1);
Allocation[i][j] = atoi(strNum12);
nEnter1 = nRet1 + 1;
nRet1 = strTest1.Find('\r', nEnter1);
i++;
}