User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 427,227 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,220 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 303 | Replies: 3
Reply
Join Date: Jul 2008
Posts: 2
Reputation: ravjot28 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ravjot28 ravjot28 is offline Offline
Newbie Poster

Quick Search in File handling

  #1  
Jul 17th, 2008
I made a project on telephone directory.
I have used single class and my reading and writing in the file is done by
fin.[write/read]((char*)&object,sizeof(object));
Now the problem is during searching a particular name or phone no. is just read the file and match the name or the phone no. in each record.

Now is there any method or way i which my searching speed is increased and it can handle large datas.

Plzz help me
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2005
Posts: 3,639
Reputation: Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of 
Rep Power: 22
Solved Threads: 418
Colleague
Salem's Avatar
Salem Salem is offline Offline
void main'ers are DOOMed

Re: Quick Search in File handling

  #2  
Jul 17th, 2008
Yes, that's about the size and shape of it.

If you want it quicker, store it in memory.
If you want it quicker, sort it and use a binary search.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Do not PM me for help; You'll be ignored, or told to learn to read.
Do not ask me if I'm muslim - I'm not. Nor do I care about yours or anyone else's mysticism. Religion is a matrix, take the RED PILL.
Reply With Quote  
Join Date: Jul 2008
Posts: 2
Reputation: ravjot28 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ravjot28 ravjot28 is offline Offline
Newbie Poster

Re: Quick Search in File handling

  #3  
Jul 17th, 2008
Sir but when write in the file at time the data is stored in the memory.
And for sorting them i tried out storing the first character of the name of the user details.
First i compare the first letter and then i compare the string this would increase the speed of the search and can it be used for heavy data search?????

plzz help
Reply With Quote  
Join Date: Dec 2005
Posts: 3,639
Reputation: Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of 
Rep Power: 22
Solved Threads: 418
Colleague
Salem's Avatar
Salem Salem is offline Offline
void main'ers are DOOMed

Re: Quick Search in File handling

  #4  
Jul 18th, 2008
Try it and find out.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Do not PM me for help; You'll be ignored, or told to learn to read.
Do not ask me if I'm muslim - I'm not. Nor do I care about yours or anyone else's mysticism. Religion is a matrix, take the RED PILL.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 11:37 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC