title: How to read a matrix from a txt file in Rust?
body: <p>File example; square matrix; size of matrix after #</p>
  
  <pre><code>#3
  1.1 -0.2 0.1
  0.1 -1.2 -0.2
  0.2 -0.1 1.1
  </code></pre>
  
  <p>Approximately so i would write it in C</p>
  
  <pre><code>double **A;
  int i,j,size=0;
  FILE *f=NULL;
  
  f=fopen("input.txt","w");
  fscanf(f,"#%d\n",&amp;size);
  A=(double**)malloc(size*sizeof(double*));
  for(i=0;i&lt;size;i++)
      A[i]=(double*)malloc(size*sizeof(double));
  
  for(i=0;i&lt;size;i++)
  {
      for(j=0;j&lt;size;j++)
      {
          fscanf(f,"%lf",&amp;A[i][j]);
      }
  }
  fclose(f);
  </code></pre>
  
  <p>I tried to use the method "read_to_string" and parse String, but I'm confused by the conversion between String and str.</p>