see the changes below

Code:
#include<stdio.h>
#include<string.h>

#define count 2000000
void getString(char *string,int buffer){//with this function we remove \n from the end of what fgets read ,if there is one.
    int i=0;
    fgets ( string, buffer, stdin );
    for ( i = 0; i < buffer; i++ ){
        if ( string[i] == '\n' ){
            string[i] = '\0';
            break;
        }
    }
}

void add(char word[],char meaning[])
{
    FILE *fp;
    fp = fopen("words.txt","a");
    fprintf(fp,"%9s=%40s\n",word,meaning);
    fclose(fp);//close the file
}

void processing(void)
{

    int i = 0,delay;
    printf("Processing....\n\n");        
    for(delay=0;delay<count;delay++)
            ;
    printf("\n");
}
    

void getwords(void)
{

    FILE *fp;
    fp = fopen("words.txt","r");
    if(fp!=NULL)
    {
        printf("\n/**************************** DICITIONARY **********************************/\n\n\n");
        char words;
        while((words = fgetc(fp)) != EOF)
        {
            putchar(words);
        };
        fclose(fp);
    }
    if(fp=NULL)
    {
        printf("Unable to open the file!\n");
    }
        
}
    
int main(){
    int selection=0;
    char word[10];
    char meaning[40];
    while (selection!=3){//your menu needs a loop
        printf("$$$$ Welcome to Aneesh's Dicitionary $$$$\n\n");
        printf("1. Show the dicitionary .\n");
        printf("2. Add words to dicitionary .\n3. Exit\n");
        printf("\tYour selection (1 , 2 or 3 [to quit]  ) : ");        
        selection=(int)fgetc(stdin)-'0';//convert char input to integer
        getchar();//for garbage

        if( selection ==  1){
            processing();        
            getwords();
        }else if( selection == 2){
            processing();        
            printf("Enter word to add: ");              
            getString(word,9);          
            printf("Meaning : ");
            getString(meaning,39);//error   here ,watch your copy paste!!!
            add(word,meaning);
       }
    }   //loop ends here
}

Last edited by virxen; 2Apr2010 at 02:26..
lionaneesh like this