title: File not saving, or not
body: <p>I cannot seem to figure out why, during the while loop at the bottom, </p>
  
  <pre><code>std::cout &lt;&lt; line;
  </code></pre>
  
  <p>does not print anything.</p>
  
  <p>I believe that the test.txt file is not actually being written to because when I open test.txt in my folder, its empty. Any thoughts?</p>
  
  <pre><code>void Ticket::WriteTicket()
  {
      std::string ticketInput;
      std::ofstream ticketFile("test.txt");
  
      ticketFile.open("test.txt");
      std::cout &lt;&lt; "Please Enter Ticket Information: " &lt;&lt; std::endl;
      getline(std::cin, ticketInput);
  
      std::cout &lt;&lt; ticketInput &lt;&lt; std::endl; //does print out the line
      ticketFile &lt;&lt; ticketInput;
      ticketFile.close();
  
      //here for testing only
      std::string line;
      std::ifstream ticketRead("test.txt");
  
      while(getline(ticketRead, line));
      {
          std::cout &lt;&lt; "something here?: " &lt;&lt; line; // there is nothing here when it outputs
      }
  }
  </code></pre>
  
  <p><strong>EDIT (SOLUTION):</strong></p>
  
  <p>After using some of the information that was given above, mainly from <em>Basile Starynkevitch</em> (I put this here because I cannot upvote yet), I was able to get the code to work!</p>
  
  <p>I also did some research in my book and copied a similar program's style. Aka where to put what part of the code, and then the input worked. I continued on with the output and the key part was the <code>std::ifstream::in</code> in the opening of the file for output.</p>
  
  <pre><code>void Ticket::WriteTicket()
  {
      std::string ticketInput;
  
      std::cout &lt;&lt; "Please Enter Ticket Information: " &lt;&lt; std::endl;
      getline(std::cin, ticketInput);
  
      std::ofstream ticketFile("Ticket.txt");
  
      ticketFile &lt;&lt; ticketInput &lt;&lt; std::endl;
  
      ticketFile.close();
  
      //here for testing
      std::ifstream ticketRead;
      ticketRead.open("Ticket.txt", std::ifstream::in);
      std::string line;
  
      while(getline(ticketRead, line))
      {
          std::cout &lt;&lt; line &lt;&lt; std::endl;
      }
  }    
  </code></pre>
  
  <p>Thank you for the help everyone!</p>