I am trying to append data into a file, and I am having trouble in checking if the input data is already there in the file. If the data is already there in the file, then it won't add that data again. Can anyone tell me what shall I do in this case? I have attached a copy of my code for your reference. Thanks!
void addentry(char* name, char* entry){
ifstream in_file(name);
ofstream out_file(name, ios::app);
out_file << entry << endl;
if(!in_file) {
cout << "This is the first entry of this person" << endl;
}
int_file.close();
out_file.close();
}