hi friends... i need code for notepad program... i'm trying to create a new notepad using c++... i cant complete that... i need code for database connectivity with this program for dictionary use in notepad program.. pls help me guys!!!!!!!!!!
----
ramya

Dani AI

Generated

— split this into four focused pieces: the editor UI, word/token extraction, the lookup/spell engine, and where you persist user data (dictionary). was right to ask for code, and the other replies pointed to two useful directions: use an existing text widget to avoid reinventing editor behavior () and handle tokenization carefully (). ’s suggestion to reuse a spell engine is also on target — building a full spell engine from scratch is unnecessary for most apps.

Choose a GUI toolkit first (so you get a solid text control, selection, context menus and events). For cross-platform C++ the Qt or wxWidgets toolkits give rich text widgets and easy event hooks (Qt docs, wxWidgets). On top of the editor, integrate a mature spell/dictionary backend (for example, use a library that accepts word files and returns suggestions and stems).

A practical, minimal workflow:

  • On edit/caret move extract the current token (letters, apostrophes, hyphens).
  • Call the spell/dictionary API to test the token and request suggestions.
  • Show suggestions in a context menu and allow replacement or “add to user dictionary”.
  • Store user words and any definition data in a small local DB (SQLite) for fast lookups and persistence.

Example high-level flow (pseudocode):

onTextChanged() {
  word = extractWordAtCaret();
  if (!spellEngine.spell(word)) {
    suggestions = spellEngine.suggest(word);
    showSuggestionsMenu(suggestions);
  }
}

For definitions you can import a dataset (WordNet or a Wiktionary dump) into SQLite and use an FTS virtual table for fast prefix/fuzzy searches:

CREATE VIRTUAL TABLE dict USING fts5(word, definition);

Troubleshooting tips: start with a small wordlist, test encoding (use UTF-8), debounce checks to avoid UI lag, run heavy lookups on a background thread, and persist user entries separately so users can add words without modifying the core dictionary. Useful references: [Hunspell-style dictionaries and engines], [SQLite for local storage] — use those tools rather than building a DB engine from scratch.

Recommended Answers

All 4 Replies

Post your code and specific problem..

MFC has a class that's almost like Notepad. All you need to do is use either VC++ 6.0 compiler or VC++ 2005. About all you have to actually code is the menu items.

Don't know a thing about your dictionary question.

Guessing you mean a file parser for the dictionary. Research tokens and i/o file parsing for using a dictionary-esque rule base of language spell checking in your application.

ramyavairamani,

I think i may have a much easier solution for you, then learning database programming. My solutions is, there is about 200 Spell Checker and Thesaurus Libraries updated daily, and in use, such as Microsoft's VSpell which is actually crap. However, at the following link you will find GNU Spell, InternatialISpell, and many other good ones.
http://thefreecountry.com/sourcecode/spellcheckers.shtml

Now also,for your database connectivity. If you absolutely want to complete your own spell checker and/or thesaurus, i would recommend using an xBase database, found at:
https://sourceforge.net/search/?type_of_search=soft&words=xBase

then, once you download the xbase package, you just include xbase64.h, and xbdbf.h, and link to xbase64.lib.

then the code follows:

xbXbase x;
xbDbf y( &x);
char * buffer = new char[255];

void GetWord(void);
void GetWord()
{
    //Open the Database
   y.OpenDatabase('DatabasePathandName.dbf");
y.GetFirstRecord();
y.GetField(y.GetFieldNo("RIGHTSPELLING"),buffer);
//Do Something with the field data
delete buffer;
}

evidentally, you will have play with database structures and layouts, to make it work with your application.

don't forget to close the database when finnished using

y.CloseDatabase();

also, you will need a dbf viewer and editor to edit the database file, you can get it from here, its free with a nag screen, or 45.00 to buy:http://whitetown.com/cdbf/

Hope some of that helps anyways.
Thanks,
Lance Wassing

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.