title: Creating a file from a output function
body: <p>I am calling the function below by a character 'a', I want to call another function by char 'b' to  make a file after displayEntry(i); I am confused to create a file from display fun(), can anyone please help me out ?</p>
  
  <p>In my assignment it is written as below :</p>
  
  <p>(a) Search a certain last name
  (b) Save the search result in a file</p>
  
  <p>Where (a) is done but got stuck with (b)...........</p>
  
  <pre><code>    // My code is :
  void addBook::searchEntry() {
      char lastname[32];
      cout &lt;&lt; "Enter last name : ";
      cin &gt;&gt; lastname;
      for(int i = 0;i &lt; count;++i) {
          if(strcmp(lastname, entries[i].lastName) == 0) {
              cout &lt;&lt; "Found ";
              displayEntry(i);
          }
          cout&lt;&lt;endl;
      }
  }
  </code></pre>