student information in c++ fstream

how to add a record,
how to edit a record,
how to search the record,
how to delete the record

using a text file or file handling in c++

Here's the following code...
Last edited on
A text file has sequential access. So unless the records are exactly the same length, which is not the case in a text file, you need to read it into memory, make your changes, then rewrite the file.
we need code to start off with...
I won't write any code unless you're really stuck; it more about teaching you how to fish rather than giving you fish.

You need to define your record. It seems your record has a: name, id, course.

Then you need to create a collection of records which is filled in when you read the file. A collection is a vector, list, set, map, ... If you're not sure what to use, start with vector. Later on you may need to change to something more convenient.

If you need to change a record, you need to search for the one you're interested in and change the details.

At the end, you overrite the file with the content of the collection.
Topic archived. No new replies allowed.