Click here to Skip to main content
16,005,222 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MAPI - Send HTML Email? Pin
Skute7-Apr-04 7:37
Skute7-Apr-04 7:37 
GeneralRe: MAPI - Send HTML Email? Pin
PJ Arends7-Apr-04 13:41
professionalPJ Arends7-Apr-04 13:41 
GeneralRe: MAPI - Send HTML Email? Pin
Skute7-Apr-04 22:35
Skute7-Apr-04 22:35 
GeneralRe: MAPI - Send HTML Email? Pin
Skute7-Apr-04 23:15
Skute7-Apr-04 23:15 
Generalpassing by reference in c Pin
kfaday7-Apr-04 3:55
kfaday7-Apr-04 3:55 
GeneralRe: passing by reference in c Pin
Skute7-Apr-04 4:06
Skute7-Apr-04 4:06 
GeneralRe: passing by reference in c Pin
kfaday7-Apr-04 4:13
kfaday7-Apr-04 4:13 
GeneralRe: passing by reference in c Pin
Paul Ranson7-Apr-04 5:53
Paul Ranson7-Apr-04 5:53 
Do you really have to use C? This seems like an obvious application for something like std::set<std::string> to me.

Anyway.

void LoadReservedWords ( char *** pppc )
{
    int i ;
    int count = CountReservedWords () ;
    char ** ppc  ;

    ppc = (char **) malloc (( count + 1 ) * sizeof ( char * )) ;

    for ( i = 0; i < count; ++i )
    {
        ppc [ i ] = ( char * ) malloc ( sizeof ( char ) * ReservedWordSize ( i ));
        strcpy ( ppc [ i ], ReservedWord ( i )) ;
    }
    ppc [ i ] = (char *) malloc ( sizeof ( char )) ;
    *ppc [ i ] = '\0' ;

    *pppc = ppc ;
}

void FreeReservedWords ( char ** ppc )
{
    char ** ppc2 = ppc ;

    while ( **ppc2 )
    {
        free ( *ppc2 ) ;
        ++ppc2 ;
    }
    free ( *ppc2 ) ;
    free ( ppc ) ;
}

int main(int argc, char * argv[])
{
    char ** ppc ;
    int n ;
    LoadReservedWords ( &ppc ) ;

    for ( n = 0; *ppc [ n ]; ++n )
    {
        printf ( "%s\n", ppc [ n ]) ;
    }

    FreeReservedWords ( ppc ) ;

    return 0 ;
}


I've obviously glossed the counting and accessing of your reserved words. Space is made for an empty string on the end of the array to use as a sentinel.

Paul
GeneralRe: passing by reference in c Pin
kfaday8-Apr-04 4:32
kfaday8-Apr-04 4:32 
GeneralCListCtrl hwnd 0x00 Pin
ns7-Apr-04 3:28
ns7-Apr-04 3:28 
GeneralRe: CListCtrl hwnd 0x00 Pin
RChin7-Apr-04 4:54
RChin7-Apr-04 4:54 
GeneralThanks! Pin
ns7-Apr-04 5:25
ns7-Apr-04 5:25 
GeneralTool bar with Slider Pin
Cedric Moonen7-Apr-04 3:26
Cedric Moonen7-Apr-04 3:26 
QuestionHow to set Data Source on MS ADO DataGrid Controller Pin
Holger Helmich7-Apr-04 3:24
Holger Helmich7-Apr-04 3:24 
GeneralSeparating words and wrapping lines Pin
Navin7-Apr-04 2:55
Navin7-Apr-04 2:55 
GeneralRe: Separating words and wrapping lines Pin
David Crow7-Apr-04 5:50
David Crow7-Apr-04 5:50 
GeneralRe: Separating words and wrapping lines Pin
Ravi Bhavnani7-Apr-04 6:08
professionalRavi Bhavnani7-Apr-04 6:08 
GeneralRe: Separating words and wrapping lines Pin
David Crow7-Apr-04 7:16
David Crow7-Apr-04 7:16 
GeneralCFontDialog custom color selection Pin
aputic7-Apr-04 2:52
aputic7-Apr-04 2:52 
Generalgetline() Pin
dairiseky7-Apr-04 2:47
dairiseky7-Apr-04 2:47 
GeneralRe: getline() Pin
avenger_sb257-Apr-04 4:15
avenger_sb257-Apr-04 4:15 
GeneralRe: getline() Pin
PrashantJ7-Apr-04 4:18
PrashantJ7-Apr-04 4:18 
GeneralReaching an element of a std::list Pin
Jerome Conus7-Apr-04 2:09
Jerome Conus7-Apr-04 2:09 
GeneralRe: Reaching an element of a std::list Pin
Kevin McFarlane7-Apr-04 2:35
Kevin McFarlane7-Apr-04 2:35 
GeneralRe: Reaching an element of a std::list Pin
Diddy7-Apr-04 2:43
Diddy7-Apr-04 2:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.