티스토리 뷰
목차
반응형
MFC CPtrList, CStringList 클래스 배열 사용 예제
CStringList
[Insert, etc...]
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | S10 = "abc"; CR1.SetAt( PS1, "aaa" ); PS1 = CR1.InsertAfter( PS1, "BBB" ); PS1 = CR1.InsertAfter( PS1, "CCC" ); PS1 = CR1.InsertAfter( PS1, "EEE" ); PS1 = CR1.InsertBefore( PS1, "DDD" ); PS1 = CR1.AddTail( "FFF" ); BOOL B1 = CR1.IsEmpty( ); B=TRUE(1); int N1; N1 = CR1.GetCount( ); CString D1; D1 = CR1.GetHead( ); D1 = CR1.GetTail( ); PS1 = CR1.GetHeadPosition( ); D1 = CR1.GetAt( PS1 );PS1 D1 = CR1.GetNext( PS1 ); D1 = CR1.GetNext( PS1 ); D1 = CR1.GetNext( PS1 ); D1 = CR1.GetNext( PS1 ); D1 = CR1.GetNext( PS1 ); D1 = CR1.GetNext( PS1 ); PS1 = CR1.GetTailPosition( ); D1 = CR1.GetPrev( PS1 ); D1 = CR1.GetPrev( PS1 ); N1 = CR1.GetCount( ); PS1 = CR1.GetHeadPosition( ); for( int i=0; i<N1; i++ ) { pDC->TextOut( 0, i*25, CR1.GetNext( PS1 ) ); } PS1 = CR1.FindIndex( 3 ); PS1 = CR1.Find( "CCC" ); D1 = CR1.GetAt( PS1 ); PS1 = CR1.Find( "CCC", PS1 ); if ( PS1 != NULL )D1 = CR1.GetAt( PS1 ); PS1 = CR1.GetHeadPosition( ); CR1.RemoveAt( PS1 ); D1 = CR1.RemoveHead( ); D1 = CR1.RemoveTail( ); CR1.RemoveAll( ); PS1 = CR1.AddHead( "AAA" ); | cs |
[MFC CPtrList, CStringList 클래스 배열 사용 예제]
CPtrList
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 | #include <afxtempl.h> CTypedPtrList< CPtrList, CCR* > *pA5 = new CTypedPtrList< CPtrList, CCR* >; delete( pA5 ); CTypedPtrList< CPtrList, CCR* > CR5; CCR L50("AAA", 500); CCR L51("BBB", 501); CCR L52("CCC", 505); POSITION PS5; PS5 = CR5.AddHead( &L50 ); PS5 = CR5.InsertAfter( PS5, &L51 ); PS5 = CR5.InsertAfter( PS5, &L52 ); PS5 = CR5.GetHeadPosition( ); CCR *pD5; CString D5_S; int D5_N; pD5 = CR5.GetNext( PS5 ); D5_S = (*pD5).Get_S( ); D5_N = pD5->Get_N( ); pD5 = CR5.GetNext( PS5 ); D5_S = pD5->Get_S( ); D5_N = pD5->Get_N( ); | cs |
MFC CPtrList, CStringList 클래스 배열 사용 예제
반응형