C++ matrix output using ofstream
<p>I am trying to make the function output numbers in a form of a matrix, not just a line</p>

<pre><code>void SaveMatrix(TMatrix* mat){
  ofstream SaveM;
  SaveM.open("Matrix.txt", ios::out);
  if (SaveM.is_open()){
      for (int i=0; i&lt;mat-&gt;line; ++i){
          for (int j=0; j&lt;mat-&gt;column; ++j){
              SaveM&lt;&lt; mat-&gt;m[i][j]&lt;&lt;" ";
          }
      }
  }else{
     cout&lt;&lt;"file is open"&lt;&lt;endl; 
  }
}
</code></pre>

<p>I tried to put this in the second for-cycle, without a result</p>

<pre><code>if(j==mat-&gt;column){
    SaveM&lt;&lt;endl;
}
</code></pre>

<p>The matrix is declared:</p>

<pre><code>struct TMatrix {
double* *m;
    int line;
    int column;
};
</code></pre>