Solved

reading index file

Posted on 2013-06-04
3
279 Views
Last Modified: 2013-06-18
In my application, I see b-trees are populated in memory and is stored persistenty on file on the system also. How can I read this file, as I need to replace all the values of keys due to change in data structure of value
0
Comment
Question by:perlperl
3 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 39219146
That depends on your application.
Does your application have a function to read the file?
Can you determine the file format your application uses to store  b-trees?
0
 
LVL 33

Expert Comment

by:sarabande
ID: 39219488
if you have the store function you easily could deduce the read function from it (if not already exists as mentioned by ozo). in some cases the stored data was encrypted and needs decryption when read from file.

normally a stored b-tree would be read at initialization phase into memory. it is much likely that it has fixed-record length and binary data.

changing the keys will arise problems in a b-tree as the keys are sorted and (normally) are stored in packed format. so any change in length or value would make the tree invalid as long as you don't use the built-in remove and insert functions.

Sara
0
 
LVL 15

Accepted Solution

by:
Minh Võ Công earned 500 total points
ID: 39253330
This is a sample implementation B-tree in file

http://forum.codecall.net/topic/41058-b-tree-c-implementation/
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now