|
Subject:
|
using seekg to serach through a file
|
|
Posted By:
|
skarmoo
|
Post Date:
|
12/8/2003 5:41:50 AM
|
I am trying out to write a program that will use seekg() to navigate the various fields in a phone book.I want to get a function that will search a particular field and one that will delete a particular record.Any help will be appreciated.Send any help to skarmoo@hotmail.com
|
|
Reply By:
|
7stud
|
Reply Date:
|
12/16/2003 9:49:29 PM
|
seekg() puts the internal file pointer at the place in the file you specify. Then you can read from that point to examine the field that is there.
As for deleting a particular record, you need to read in the data into a string, change it, then write it back to the file. I don't think you can selectively write to a spot in a file--everything after that spot gets erased when you write.
|