Help me plase :: Array of CString
-
... toMatrix(int row,int colum,CString matrix) { Cstring m[row][colum];//Why this line erroe????? return ...;// } I need return m to other function,plase tell the way. thank you.
-
... toMatrix(int row,int colum,CString matrix) { Cstring m[row][colum];//Why this line erroe????? return ...;// } I need return m to other function,plase tell the way. thank you.
Try something like this... // *************************************** // Example: Dynamic Multidimensional Array // *************************************** // We want both array dimensions to be allocated dynamically and // to be able to reference an element as x[i][j] // Here's how to do it... // *********** // MFC Version // *********** // Array of ints typedef CArray CIntArray; // Array of arrays of ints typedef CArray CMultiIntArray; void TraceDynamicArray(const unsigned int rows, const unsigned int columns) { CMultiIntArray aTest; // Allocate number of rows aTest.SetSize( rows ); // For each row for (int row = 0; row < aTest.GetSize(); row++) { // Allocate number of columns aTest[row].SetSize( columns ); // For each column for (int column = 0; column < aTest[row].GetSize(); column++) { // Assign a value aTest [row] [column] = 10 * row + column; // Trace it afxDump << aTest [row] [column] << "\t"; } afxDump << "\n"; } } In your case you need to have // Array of CString typedef CArray CStringArray; // Array of arrays of CString typedef CArray CMultiStringArray; Kevin