Thinking in C++

My C++ code snips.

Posts Tagged ‘personal dicitionary’

Personal Dictionary App

Posted by Abhi on February 11, 2012

Over the past couple of days, I’ve been busy writing a small personal dictionary program that will allow me to add words that I’ve learnt to a file and then access them later if need be.

You can add words using the “add <word> <meaning> <notes>” command via the linux terminal. <notes> is optional. You can then view the words that have been added using the “define <word>” command. To easily view all the words that have been added to the file, I created the “exportdict” command that transforms the file into a cleanly formatted html document that can be viewed through your preferred browser.

Commands

HTML Screenshot

The entire program took me about two days to write. It employs a few basic checks such as – not allowing multiple similar entries but nothing major. The database file that the program uses is called dict-data.rog and it will be created in the same folder as the executable. Now this application isn’t exactly fault tolerent so if you make any changes to the databse file, make sure that the format is kept intact. If that is not possible then simply delete the file. Needless to say your data will be lost, hence it might be a good idea to back it up first.

General Format of the data in the database: “<entry>|<value>|<notes>” where “|” is the seperator.

Unless you want your database to be screwed up I suggest not adding “|” in your entries. In case incompatible data is found, the program will inform you of the entry which contains the incompatible data.

Currently the only way to edit existing entries is to edit them manually by opening the database file. I may write a small add-on to remedy that depending on whether or not I need it.

The executables that I’ve provided will run on a 64-bit Linux machines. I’ve also provided the source code so if you wish you can download and compile them for your platform. They should run on Windows too but I’m not entirely sure.

Feel free to make changes to the source code, and any suggestions. If you use the program and find any bugs, let me know.

Source Code : Download Here

Executables : Download Here

Posted in C++, Projects | Tagged: , | 2 Comments »