Question: how can i read and write a txt file for the given struct in C++ struct Entry { string name; string number; }; it is

how can i read and write a txt file for the given struct in C++

struct Entry { string name; string number; };

it is also given: vector directory;

at the beginning of the programm the file should be read with a function: void read(vector& directory, const string& filename) and store the data seperated by white space in the vector directory, if there are any errors like the file doesnt exist it should be displayed.

in the end the programm should write the changed vector directory into a txt file by overwriting the initial data in the txt file the function is void write(const vector& directory, const string& filename). If there could be some errors it should be implemented

write the two functions for the programm

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!