Your logic in your first code listing just will not work. For example for(int r = 0; r < numRows; r++)
you use numRows as the loop limit, but numRows is what you are trying to calculate. What will be its value the first time the loop is entered? 0 seems most likely so then the loop never executes. The same applies to numCols.
for(int c = 0; c < numCols; c++)
{
fin >> value;
fout << value << "\t";
if(!(getline(fin, endLine)))
numCols++;
}
You do realise that getline will consume all the data left on the current line. That means that the second time round the loop you will have finished processing the current line and the first value you read on line 3 will be the first value on the next line.
Also yo do not do nearly enough error checking, line 3 could result in one or more of the stream status bits being set.
As far as input is concern a newline is just another white space character. You will get no particular indication that you have gone pasted one. However the newlines are important to you because the indicate the number of rows. I would suggest doing line reads from the file and then parsing the data on the line using a istringstream to get the values/number of values on the line.