Here's a very very very simple way to do this:
Code:
char word[1024]={0};
int x=0;
FILE* fp = fopen("DoYourOwnErrorChecking.Ok", "r" );
do
{
word[x] = fgetc( fp );
if ( isspace( word[x] ) ) {
catagorize( word ); // drop this word in the correct node
x = 0;
}
else x++;
}
while( !feof( fp ) );
Now, you make a function that is passed a single word:
Code:
void catagorize( char *word )
{
int startsWithUnderline = 0;
int endsInColon = 0;
int startsWithLower = 0;
if( word == NULL ) return;
if( word[0] == '_' ) startsWithUnderline = 1;
else if ( isupper( word[0] ) ) startsWithLower = 1;
...
if( startsWithUnderline && endsInColon )
addToNode( underlineColonNode, word );
if( ...
}
You get the idea.
Quzah.