Thread: Data Storage Method

  1. #1
    Registered User
    Join Date
    Sep 2006

    Question Data Storage Method

    I am writing a program to test/increase a user's vocabulary in a foreign language. I eventually want to provide edit functionality (users can add new words) and "plug-in" functionality for additional dictionaries but v1.0 will only have a single static language dictionary.

    What is the best method to store and retrieve data? The data stored will be "word pairs."

    Example (English <-> Japanese):


    Since the user has an option to repeat wrong answers, I have chosen a linked list style to manage the word pairs.

    struct node {
      char* english;
      char* japanese;
      struct node* next;
    However, I need a method of "storing" the dictionary. Is it most efficient to store it as a text file? I would prefer the list to be encrypted or otherwise stored so that a user can't freely edit the dictionary with a text editor. Should I store the words in the source code somehow? If so, what is the best way to do this?

    Long term, I need to be able to store UTF-8 code for foreign language characters such as SHIFT-JIS, for example, for Japanese.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    A balanced tree, or a hash would be preferable to a linked list.

    As for encrypting the input file, the key would need to be stored somewhere. Yes, you'll stop the casual reader, but if someone wants it bad enough, they'll probably get it.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 05-05-2009, 04:53 PM
  2. C++ data storage
    By aewing30 in forum C++ Programming
    Replies: 5
    Last Post: 04-28-2008, 02:19 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Replies: 4
    Last Post: 06-14-2005, 05:45 AM
  5. C diamonds and perls :)
    By Carlos in forum A Brief History of
    Replies: 7
    Last Post: 05-16-2003, 10:19 PM