why is my append function not working
<p>My issue is that I am trying to create a function named appFunc() that will add a record to a binary file..  My popFunc works as it populates the binary file I can see by running the dispFunc() which should display whthe contents of the file.  So I dunno if there is something wrong with my dispFunc() since it just shows what I have added with the popFunc() &amp; never displays what I add with my appFunc().  I have tried changing the file stream object using fstream and ofstream but they both seem to do the same thing.  I can go through the appFunc() and actually enter information when prompted as I run the program but the only thing that actualy shows up wih option 2 of my switch is what I have done with option 1. </p>

<p>Thanks in advance!</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;stdlib.h&gt;
#include &lt;string&gt;
#include &lt;iomanip&gt;


using namespace std;

const int NAME_SIZE = 40, ADDR_SIZE = 50, PHONE_SIZE = 14;
char y, Y;
struct Info
{
 char name[NAME_SIZE];
 int age;
 char address1[ADDR_SIZE];
 char phone[PHONE_SIZE];
   }people;

 void popFunc();
 void dispFunc();
 void appFunc();
 void delRecFunc();
 void searchFunc();
 void modRecFunc();
 void wipeFunc();
int main()
{
Info person;
char choice, option;

do
{



 cout &lt;&lt; "  Simple People Records  \n \n \n "
     &lt;&lt; "     Please choose from the following options.. \n \n \n"
     &lt;&lt; " 1.  POPULATE THE BINARY FILE \n "
     &lt;&lt; " 2.  DISPLAY THE CONTENTS OF THE FILE\n"
     &lt;&lt; " 3.  APPEND A RECORD TO THE FILE\n"
     &lt;&lt; " 4.  DELETE A RECORD FROM THE FILE\n"
     &lt;&lt; " 5.  SEARCH FOR A CERTAIN RECORD\n"
     &lt;&lt; " 6.  MODIFY A CERTAIN RECORD. \n"
     &lt;&lt; " 7.  WIPE OUT THE ENTIRE CONTENTS OF THE FILE. \n" &lt;&lt;endl;
 cin  &gt;&gt; option;

 switch(option)
 {
              case '1': popFunc();
                        cout &lt;&lt; people.name;
                        system("pause");
                      break;

              case '2': dispFunc();
                      break;

              case '3': appFunc();
                      break;

              case '4': delRecFunc();
                      break;

              case '5':searchFunc();
                     break;

              case '6':modRecFunc();
                     break;

              case '7':wipeFunc();
                     break;



              }
    }
 while(choice!= 1000);

 system("pause");
 return(0);
 }





void popFunc()

 {    fstream file("stuff.dat", ios::out | ios::binary);

 //file.open("stuff.dat", ios::out | ios::binary);
 if (file.fail())
    {    
         cout &lt;&lt; "the file does not exist so we are creating it now...  ";
        system("pause");
        file.open("stuff.dat", ios::out);   

    }


cout &lt;&lt; "enter the following data about a person:  "&lt;&lt;endl;
cout &lt;&lt; "Name: "  &lt;&lt;endl;
cin &gt;&gt; ws;
cin.getline(people.name,NAME_SIZE);
cout &lt;&lt; "Age (integers only or the program will be corrupted):  " &lt;&lt;endl;
cin &gt;&gt; people.age;
cin.ignore(); //skip over the remaining newline.
cout&lt;&lt; "Address line 1:  ";
cin &gt;&gt; ws;
cin.getline(people.address1,ADDR_SIZE);
cout &lt;&lt; "Phone:  ";
cin &gt;&gt; ws;
cin.getline(people.phone,PHONE_SIZE);
file.write(reinterpret_cast&lt;char *&gt;(&amp;people), sizeof(people));
file.close(); 
}

void dispFunc()

 {
     Info people;
         ifstream file;
     file.open("stuff.dat", ios::binary);
         if (file.fail())
   {    
        cout &lt;&lt; "the file does not exist so we are creating it now...  ";
        system("pause");
        file.open("stuff.dat", ios::out);   

   }

     file.read(reinterpret_cast&lt;char *&gt; (&amp;people), sizeof(people));

     cout &lt;&lt; "the name is "&lt;&lt; people.name &lt;&lt;endl;
     cout &lt;&lt; "the age is "&lt;&lt; people.age &lt;&lt;endl;
     cout &lt;&lt; "the address is" &lt;&lt;people.address1 &lt;&lt;endl;
     cout &lt;&lt; "the phone is " &lt;&lt;people.phone &lt;&lt;endl;

     file.close();

     }

void appFunc()
{    ofstream file;
     file.open("stuff.dat",  ios::binary | ios::app); 
         if (file.fail())
   {    
        cout &lt;&lt; "the file does not exist so we are creating it now...  ";
        system("pause");
        file.open("stuff.dat", ios::out);   

   }

cout &lt;&lt; "Name: "  &lt;&lt;endl;
cin &gt;&gt; ws;
cin.getline(people.name,NAME_SIZE);
cout &lt;&lt; "Age (integers only or the program will be corrupted):  " &lt;&lt;endl;
cin &gt;&gt; people.age;
cin.ignore(); //skip over the remaining newline.
cout&lt;&lt; "Address line 1:  ";
cin &gt;&gt; ws;
cin.getline(people.address1,ADDR_SIZE);
cout &lt;&lt; "Phone:  ";
cin &gt;&gt; ws;
cin.getline(people.phone,PHONE_SIZE);
    file.write(reinterpret_cast&lt;char *&gt;(&amp;people), sizeof(people));
    file.close();





     }
void delRecFunc()
{
     cout &lt;&lt; "testing 3"&lt;&lt;endl &lt;&lt; endl;

     }

void searchFunc()
{
     cout &lt;&lt; "testing 4"&lt;&lt;endl &lt;&lt; endl;
     }

void modRecFunc()
{
     cout &lt;&lt; "testing 5"&lt;&lt;endl &lt;&lt; endl;
     }
void wipeFunc()


{
     cout &lt;&lt; "testing 6"&lt;&lt;endl&lt;&lt; endl;
     }
</code></pre>
