title: Appending text to a file
body: <p>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!</p>
  
  <pre><code>void addentry(char* name, char* entry){
  
  ifstream in_file(name);
  ofstream out_file(name, ios::app);
  
  
  out_file &lt;&lt; entry &lt;&lt; endl;
  
  if(!in_file) {
     cout &lt;&lt; "This is the first entry of this person" &lt;&lt; endl;
  } 
  
  
  int_file.close();
  out_file.close();
  }
  </code></pre>