티스토리 뷰

목차

    반응형

    MFC 배열 CByteArray 사용법 (New, Delete, Set, Add)


    CByteArray - 1


    [New, Delete]

    1
    2
    3
    4
    5
    6
    7
    8
    CByteArray* pA = new CByteArray;
    pA->SetSize( 25 );
     
    delete( pA );
    pA = NULL;
     
    delete(pA);
    pA =NULL;
    cs

    [SetSize, SetAt]


    1
    2
    3
    4
    5
    6
    7
    8
    CByteArray AL;
     
    AL.SetSize( 8 );
    AL.SetSize( 45 );
     
    AL.SetAt( 0100 );
    AL.SetAt( 1'A' ); 
    AL.SetAt( 1'B' );
    cs


    [SetAtGrow]


    1
    2
    3
    AL [2= 102
    AL.ElementAt( 3 ) = 103
    AL.SetAtGrow( 4104 );
    cs


    [Add, InsertAt, RemoveAt]


    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    int N;
    = AL.Add( 106 );
    AL.InsertAt( 51053 );
    AL.InsertAt( 5, ALx );
    AL.RemoveAt( 52 );
     
    = AL.GetUpperBound( );
    = AL.GetSize( );
     
    BYTE D;
    = AL.GetAt( 0 );
    = AL [1];
    = AL [2];
    = AL.ElementAt( 3 );
     
    char SS[20];
    forint i=0; i<N; i++ )
    { pDC->TextOut( 025*i, _itoa(AL[i],SS,10) ); }
     
    AL.FreeExtra( );
    AL.RemoveAll( );
    cs


    MFC 배열 CByteArray 사용법 (New, Delete, Set, Add)[MFC 배열 CByteArray 사용법 (New, Delete, Set, Add)]


    CByteArray - 2


    [New, Delete]


    1
    2
    CByteArray* pA1 = new CByteArray;
    delete( pA1 );
    cs


    [SetSize, SetAt, GetAt]


    1
    2
    3
    4
    5
    6
    7
    8
    9
    CByteArray AL1;
    AL1.SetSize( 2 );
    AL1.SetAt( 0100 );
    AL1 [1= 200;
     
    int N1 = AL1.GetUpperBound( );
    BYTE D1;
    D1 = AL1.GetAt( 0 );
    D1 = AL1 [1];
    cs


    MFC 배열 CByteArray 사용법 (New, Delete, Set, Add)

    반응형