I am making some kind of phonebook that contains a person's name, phonenumber, profession, birth place and date. My problem is that i want the data to be stored in a Txt file, but the main problem is that i need a reader class and a writer class for it. If the txt file inside looked like
Firstname(can contain space);Lastname(can contain space);Phonenumber;etc;
How should i read these strings one by one and pass it to my contact?
... Here is a part of my class for contacts with setters and getters
#include "Contacts.h"
#include string
Contacts::Contacts() {}
std::string Contacts::setFirstname(std::string firstName) {
this->firstName = firstName;
}
std::string Contacts::getFirstname() {
return firstName;
}
std::string Contacts::setLastname(std::string lastName) {
this->lastName = lastName;
}
std::string Contacts::getLastname() {
return lastName;
}
...In an other class(which has several operations for contacts like add,remove) i made a dynamic array of contacts, so every time i add a new contact the size of the array increases
So i would read datas from/expect a txt file that looks like this inside after output:
John;Wick Jr;123401234;Paris;1990.01.13;Engineer;
Enrique Juan;Iglesias;123401234;Madrid;1980.11.21;Surgeon;