How to read data from a text file into a 2D dynamic array

i just wanted to ask on how I can read data from a text file, directly into a dynamically allocated 2D array, and then print that data.

This is what I tried but I'm not sure what I'm missing or where I'm going wrong; your help is greatly appreciated.

inFile.open("data.txt");
if(!inFile) //if its not open
{
    cout << "unable to open file." << endl;
}

 //declaring 2D array
for(int r = 0; r<numLines; r++)
{
    for(int c = 0; c<numLines; c++)
    {
        myArray[r] = new string[numLines];
    }
}

//counting the number of lines in the file
stringstream ss(line);
while(getline(inFile, line,','))
{
    for(int r = 0; r < numLines; r++)
    {
        for(int c = 0; c<numLines; c++)
        {
            myArray[r][c]=line;
        }
    }
    numLines++;
}
cout << endl;

//deleting the array
for(int r=0; r<arraySize; r++)
{
    for(int co=0; co<arraySize; co++)
    {
        delete [] myArray[r];
    }
    delete [] myArray;
}

//closing the file
inFile.close();