title: Reading function is called by main, but not executed
body: <p>This file read in some data from AD.txt, stores it to a string, and the writes the string to ADsubjects.txt. My write function seems to work fine but my read is not being called. Its not even going inside the read function to print the <code>cout</code> statements. I assumed that if I just simply place the call function it should appear automatically. Here is my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
      #include&lt;fstream&gt;
      #include &lt;string.h&gt;
      #include&lt;iomanip&gt;
      #include &lt;cstdlib&gt;
      #define rmax 15
      using namespace std;
      string data1;
  </code></pre>
  
  <p>Read function:</p>
  
  <pre><code>    void readSubjects(){
          cout&lt;&lt;"inside read"&lt;&lt;endl;
          ifstream is;
          is.open("AD.txt"); //opening the file
          cout&lt;&lt;"open text"&lt;&lt;endl;
          while(!is.eof()){
              char line[rmax];
              cout&lt;&lt;line&lt;&lt;endl;
              data1 += "\"";
  
              is.getline(line,rmax);
              for(int i=0; i&lt;11;i++){
                  data1 += line[i];
              }
              data1 += "\" \\ ";
          }
        is.close();
      }
  </code></pre>
  
  <p>Write function:</p>
  
  <pre><code>    void writeSubjects(){
          ofstream os;
          os.open("ADsubjects.txt",ios::out);
          os&lt;&lt;data1;
          os.close()
      }
  </code></pre>
  
  <p>Main function:</p>
  
  <pre><code>    int main() {
          readSubjects();
          cout&lt;&lt;"read"&lt;&lt;endl;
          writeSubjects();
          cout&lt;&lt;"written"&lt;&lt;endl;
          cout &lt;&lt; "Hello, World!" &lt;&lt; endl;
          return 0;
      }
  </code></pre>