Problems when creating a huge matrix
<p>I am trying to create a kind of table with random characters and writing the into a file, but I have a problem. The problem appears when I want to create huge tables. For example for a table with 10 rows x 5 columns everything is perfect, but for a table with 1.000.000 rows and 100 columns I have errors. Do you have any idea how could I solvent this problem???</p>

<p>I attached you the code I have created:</p>

<pre><code>#include&lt;iostream&gt;
#include&lt;fstream&gt;
#include&lt;stdio.h&gt;
#include&lt;string&gt;
#include&lt;ctime&gt;
#include&lt;sstream&gt;

using namespace std;

int main()
{
    int rows, columns, rowsMax, columnsMax; 
    int element1;
    char word[10];

    cout&lt;&lt;"Write the number of rows of your table: ";
    cin&gt;&gt;rowsMax;

    cout&lt;&lt;"Write the number of columns of your table: ";
    cin&gt;&gt;columnsMax;

    string matriz[100000][5]; // Here I write the number of row and columns that must be the same than the numbers introduced as input

    string table ("Table1");

    ofstream myfile (table);
    if(myfile.is_open())
    srand(1);
    for(rows=0;rows&lt;rowsMax;rows++)
    {
        for(columns=0;columns&lt;columnsMax;columns++)
        {
            element1 = rand() % 100000 + 1;

            int len = rand () % 4 + 4;
            word [len] = 0;
            while (len) word [--len] = 'A' + rand () % 58;

            myfile&lt;&lt;element1&lt;&lt;word;
            myfile&lt;&lt;"|";

            std::stringstream ss;
            ss&lt;&lt;element1;

            string mat;
            mat +=ss.str();
            mat +=word;
            matriz[rows][columns]= mat;
        }
        myfile&lt;&lt;endl;

    }
    myfile.close();

    system("pause");
    return 0;

}
</code></pre>

<p>Thanks in advance for all your help!</p>
