title: C++: Read .txt contents and store into 2D array
body: <p>So me and my groupmates suddenly have some clutchwork at hand. I was assigned of making an import function that reads through a textfile that looks like this, and store it to a 2D array:
  <img src="https://i.stack.imgur.com/abQ4a.png" alt="enter image description here"></p>
  
  <p>The columns are Tab-separated. As this suddenly came up, dont have the entire project file with me and I am nowhere near my old reliables, I tried conjuring this up in the most generic way possible:</p>
  
  <pre><code>void signal::import_data(string filename){
      ifstream file;
  
      file.open(filename.c_str());
  
      if(file.fail()){
          cerr &lt;&lt; "file open fail" &lt;&lt; endl;
      }else{
          while(!file.eof)
          {
              for(int j = 0; j &lt; NumCols; j++){
                  for(int i = 0; i &lt; NumRows; i++){
                      file &gt;&gt; _data[j][i];
                  }
              }
          }
      }
      file.close();
  }
  </code></pre>
  
  <p>Am I doing this correct? Im not so sure if streaming like this can bypass tabs, or can it? </p>