티스토리 뷰
목차
반응형
[MFC강좌] CStringArray, CPtrList, CList 사용법
CStringArray
[SetSize, SetAt, GetUpperBound, GetAt]
1 2 3 4 5 6 7 8 9 10 | CStringArray AL5; AL5.SetSize( 2 ); CString S5("AAA"); AL5.SetAt( 0, (LPCTSTR)S5 ); AL5 [1] = "BBB"; int N5 = AL5.GetUpperBound( ); CString D5; D5 = AL5.GetAt( 0 ); D5 = AL5 [1]; | cs |
[MFC강좌] CStringArray, CPtrList, CList 사용법
CPtrList
[New, Delete]
1 2 3 4 5 6 | CPtrList* pA3 = new CPtrList; CCR* pLa = new CCR("AAA", 100); PS1 = pA3->AddHead( (CObject *)pLa ); delete( pLa ); delete( pA3 ); | cs |
[InsertAfter, etc...]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | CPtrList CR3; CCR La("AaA", 300); CCR Lb("BbB", 301); CCR Lc("CcC", 302); POSITION PS3; PS3 = CR3.AddHead( &La ); PS3 = CR3.InsertAfter( PS3, &Lb ); PS3 = CR3.InsertAfter( PS3, &Lc ); PS3 = CR3.GetHeadPosition( ); CPtrList *pD3; CString D3_S; int D3_N; pD3 = (CPtrList *)CR3.GetNext( PS3 ); D3_S = (*(CCR *)pD3).Get_S( ); D3_N = ((CCR *)pD3)->Get_N( ); pD3 = (CPtrList *)CR3.GetNext( PS3 ); D3_S = (*(CCR *)pD3).Get_S( ); D3_N = ((CCR *)pD3)->Get_N( ); | cs |
[MFC강좌] CStringArray, CPtrList, CList 사용법
CList
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #include <afxtempl.h> #include "CR.h"CCR CList< CCR, CCR& >* pC4 = new CList< CCR, CCR& >(10); delete( pC4 ); CList < CCR, CCR& >CR4; CCR Li("Aaa", 400); CCR Lj("Bbb", 401); CCR Lk("Ccc", 402); POSITION PS4; PS4 = CR4.AddHead( Li ); PS4 = CR4.InsertAfter( PS4, Lj ); PS4 = CR4.InsertAfter( PS4, Lk ); PS4 = CR4.GetHeadPosition( ); CCR D4; CString D4_S; int D4_N; D4 = CR4.GetNext( PS4 ); D4_S = D4.Get_S( ); D4_N = D4.Get_N( ); D4 = CR4.GetNext( PS4 ); D4_S = D4.Get_S( ); D4_N = D4.Get_N( ); D4 = CR4.GetNext( PS4 ); D4_S = D4.Get_S( ); D4_N = D4.Get_N( ); | cs |
[MFC강좌] CStringArray, CPtrList, CList 사용법
반응형