seekp Problem...

HI! i'v got a file like this:

Lesson Name:Math Lesson File Name:1892.txt

Student ID | Number
1892 20

i want to delete "20",only "20"!
what i have to do?
would you explain seekp,seekg,tellp,tellg...
i looked everywhere for the but find nothing!
please help...
thanks so much
You are looking to do it the wrong way. You'll put as much work into it as doing it the right way but then be stuck when dealing with larger datasets.

The right way is to ignore seek and tell functions. Write a function to read the entire file into a vector of student records. Write another function to write the vector of student records to file.

Once you have done that, you can read the file, "delete" the number from the student record (by setting it to zero or however you set it up), and then overwrite the file with the new data.

Hope this helps.
Topic archived. No new replies allowed.