Creation of an index for file
I do a program to manage a number of data stored on a file, and that I will carry out operations (search, add ...).
The problem is that you create an index which will also be stored on a file, and I do not understand how to put it in place.
For example, if I make a table that includes the types (eg, my file has films -> I want to look for an action movie), I do not understand how to link this table with the other elements of the file ( I have a movie with a name, type etc).
Otherwise there are the trees but it's the same I do not understand how, if I create a structure with the file and the key to identification of the film, I fail to see how the hierarchical ordered data tree, and then how to connect all the movies with my index.
I do not know if it is comprehensible what I said, I just want to be informed on the operation and the creation of the index (that is it is a function in their own right?)
Re: Creation of an index for file
You do not have access to a database?
That's it for this, and a motion base that is still easier than simply typing the key problems of dead, corrupted files, etc..
Otherwise, simply working with files using a specific format. Either XML, or stupidly CSV with automatic interpretation house. And store them in hash tables (eg structures linked with an identifier and some fields).
In all cases, you must think about your data model before you begin typing a single line of code.
Re: Creation of an index for file
An index file is like an index at the end of a book. It has on each line: the key, then the page number, or registration, or address, where the corresponding record in the key. Usually, it indicates the number of bytes in the data file where the record and can then pick up the registration with fseek () and fread ().
If you want to do a search on the title of a film, it must be an index whose key is the film titles. If you want to research the kind of film, it must be another index which is the key type of film.
Re: Creation of an index for file
I had not interpreted "index" in this sense, is that what is required.
Not that the basic principle is difficult to code, but say that there is a whole list of cases to manage the design database took years to resolve (for example, detect the need to rebuild an index after a crash or any recovery).
Again, in this case I would prefer to use a database to focus on the data model and leave the technical management to a proven software. Especially there are free with APIs for the attack in C (MySQL).
Re: Creation of an index for file
Ok, so basically if I want to search for several different criteria, I must create as many indexes as there are criteria?