Quick Search in file handling

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
You can use some indexing to make it go faster.
For example to know that names from A-K starts at the beginning of the file and names L-Z starts from a certain point. So if your name starts from L-Z to move your reading pointer straight to the beginning of the L.
You can add additional indexes also.
Topic archived. No new replies allowed.