티스토리 뷰

목차

    반응형

    [MFC강좌] 3가지 배열 예제 (CByteArray, CWordArray, CUnitArray)


    MFC에서 제공하는 배열들은 아래와 같습니다.


    Class Name - Data Type


    CByteArray : 8-bit bytes (BYTEs)

    CWordArray : 16-bit words (WORDs)

    CDWordArray : 32-bit double words (DWORDs)

    CUIntArray : Unsigned integers (UINTs)

    CStringArray : CStrings

    CPtrArray : void pointers

    CObArray : CObject pointers


    MFC강좌 CStringList[MFC강좌] 3가지 배열 예제 (CByteArray, CWordArray, CUnitArray)

    CWordArray


    WORD: unsigned short int


    [New, Delete]


    1
    2
    CWordArray* pA2 = new CWordArray;
    delete( pA2 );
    cs


    [SetSize, SetAt, GetAt]


    1
    2
    3
    4
    5
    6
    7
    8
    9
    CWordArray AL2;
    AL2.SetSize( 2 );
    AL2.SetAt( 0100 );
    AL2 [1= 200;
     
    int N2 = AL2.GetUpperBound( );
    WORD D2;
    D2 = AL2.GetAt( 0 );
    D2 = AL2 [1];
    cs


    CUintArray


    [New, Delete]


    1
    2
    CUIntArray* pA3 = new CUIntArray;
    delete( pA3 );
    cs


    [SetSize, SetAt, GetAt]


    1
    2
    3
    4
    5
    6
    7
    8
    9
    CUIntArray AL3;
    AL3.SetSize( 2 );
    AL3.SetAt( 0100 );
    AL3 [1= 200;
     
    int N3 = AL3.GetUpperBound( );
    UINT D3;
    D3 = AL3.GetAt( 0 );
    D3 = AL3 [1];
    cs


    MFC강좌 배열[MFC강좌] 3가지 배열 예제 (CByteArray, CWordArray, CUnitArray)


    CDWordArray


    [New, Delete]


    1
    2
    CDWordArray* pA4 = new CDWordArray;
    delete( pA4 );
    cs


    [SetSize, SetAt, GetAt]


    1
    2
    3
    4
    5
    6
    7
    8
    9
    CDWordArray AL4;
    AL4.SetSize( 2 );
    AL4.SetAt( 0100 );
    AL4 [1= 200;
     
    int N4 = AL4.GetUpperBound( );
    DWORD D4;
    D4 = AL4.GetAt( 0 );
    D4 = AL4 [1];
    cs


    [MFC강좌] 3가지 배열 예제 (CByteArray, CWordArray, CUnitArray)

    반응형