![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, CPtrArray *pArrTable; CPtrArray m_pArrTable pArrTable = &m_pArrTable; I'm getting a compiler error from the following line of code: (*(PTABLE_INFO_STRUCT)pArrTable[i]).strResult = _T("3"); Any suggestion on how to fix the code? |
#3
| |||
| |||
|
|
jc wrote: Hello, CPtrArray *pArrTable; CPtrArray m_pArrTable pArrTable = &m_pArrTable; I'm getting a compiler error from the following line of code: (*(PTABLE_INFO_STRUCT)pArrTable[i]).strResult = _T("3"); Any suggestion on how to fix the code? jc: You need to dereference pArrTable before you can apply operator[]. Also, you do not ned to dereference to access a member of a class or struct; you can use the -> notation. ((PTABLE_INFO_STRUCT)(*pArrTable)[i])->strResult = _T("3"); But really, why are you using CPtrArray? Or the MFC collection classes at all really. Just learn the STL containers instead std::vector<PTABLE_INFO_STRUCT> arrTable; //... arrTable[i]->strResult = _T("3"); -- David Wilkinson Visual C++ MVP |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |