Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

How do unions affect the natural rate of unemployment?

Answered: 1 week ago

Question

3. Who would the members be?

Answered: 1 week ago

Question

What was the role of the team leader? How was he or she selected?

Answered: 1 week ago