继续问个结构的问题
结构体是这样的
struct TJList { char xh[7]; char xz[5]; }; typedef TJList* Mjlist;
dxs = new TList(); dxs->Clear(); for(int i = 0; i < m_m->Count ; i++) { str = m_m->operator [](i); m_dx = new TJzxList; AnsiString xh1 = ""; AnsiString xz1 = ""; len1 = ""; len2 = ""; for(int j = 1 ; j <= str.Length(); j++) { if(j <= 4) { xz1 += str[j]; } if(j > 4 && j <= 11 ) { xh1 += str[j]; } } StrCopy(m_dx->xh,xh1.c_str()); //每回在这个地方m_dx->xh的值都合适 len1 = (AnsiString)m_dx->xh; m_dx->xh[len1.Length() + 1] = 0x0; StrCopy(m_dx->xz,xz1.c_str()); //完成这条语句后 m_dx->xh变成了 m_dx->xh + m_dx->xz的值 //而m_dx->xh + m_dx->xz的字符数位15位,我申请的xh才有7位 len2 = (AnsiString)m_dx->xz; m_dx->xz[len2.Length() + 1] = 0x0; dxs->Add(m_dx); }