I came up with an idea to improve my vocabulary.The idea is to have large number of the most common english words in a file. I would then write a program that displays the words on the screen one at a time.If i recognize the word,I press the DOWN key to move to the next word,otherwise I press 'S' to save this word to a text file called Unknown.txt .
When i get finished,i will have collected all the words that i don't know their meaning.If i stop here,and go through each word manually and seach for it's meaning with my dictionary,it will take alot of time to learn them all this way.
However,if i have a method to save the meaning of the word programatically, i can easily open the file and learn the meaning of the words immediatly.That is what i want to acheive.
The "10kword.txt" file looks like the following:
purchase
customers
active
response
practice
hardware.
Here is the code i have so far:
#include <stdio.h>
#include <Windows.h>
void cls(void *hConsole);
int main(void)
{
    FILE *inp, *out;
    if (fopen_s(&inp, "10kWords.txt", "r")) {
        fprintf(stderr, "Unable to open input file\n");
        return 1;
    }
    else if (fopen_s(&out, "Unknown.txt", "a")) {
        fprintf(stderr, "Error opening file Unknown.txt\n");
        fclose(inp);
        return 1;
    }
    char buf[100];
    void *hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    while (1) {
        //Press the down key to move to the next word
        if (GetAsyncKeyState(VK_DOWN) == -32767) {
            cls(hConsole);
            fscanf_s(inp, "%s", buf, 100);
            printf("%s", buf);
        }
        //Press S to save the word to output file
        else if (GetAsyncKeyState('S') == -32767) {
            fprintf(out, "%s\n", buf);
            //Obtain word meaning from dictionary Programatically HERE and print it to 'out'
        }
        else if (GetAsyncKeyState(VK_ESCAPE)) {
            break;
        }
    }
    fclose(inp);
    fclose(out);
    return 0;
}
void cls(void *hConsole)
{
    COORD coordScreen = { 0, 0 };    // home for the cursor 
    DWORD cCharsWritten;
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    DWORD dwConSize;
    // Get the number of character cells in the current buffer. 
    if (!GetConsoleScreenBufferInfo(hConsole, &csbi))
    {
        return;
    }
    dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
    // Fill the entire screen with blanks.
    if (!FillConsoleOutputCharacter(hConsole,        // Handle to console screen buffer 
        (TCHAR) ' ',     // Character to write to the buffer
        dwConSize,       // Number of cells to write 
        coordScreen,     // Coordinates of first cell 
        &cCharsWritten))// Receive number of characters written
    {
        return;
    }
    // Get the current text attribute.
    if (!GetConsoleScreenBufferInfo(hConsole, &csbi))
    {
        return;
    }
    // Set the buffer's attributes accordingly.
    if (!FillConsoleOutputAttribute(hConsole,         // Handle to console screen buffer 
        csbi.wAttributes, // Character attributes to use
        dwConSize,        // Number of cells to set attribute 
        coordScreen,      // Coordinates of first cell 
        &cCharsWritten)) // Receive number of characters written
    {
        return;
    }
    // Put the cursor at its home coordinates.
    SetConsoleCursorPosition(hConsole, coordScreen);
}
 
     
     
    