dynamic array value changed
<p>I am writing a program for read a text file and put in to an array. First i put data into a char array and then convert char array to int. In my loop the value of map[,] is true. But when the FOR ends all of the map[,] changes to 0.</p>

<pre><code>#include "stdafx.h"
#include &lt;iostream&gt;
#include &lt;iomanip&gt;
#include &lt;fstream&gt;
using namespace std;

int main()
{
    char str[100];
    ifstream test;
    test.open("map.txt");
    int n,m,i=0;
    //
    while(test.getline(str, 100))
    {
        if(i==0)
            n = atoi(str);
        else if(i==1)
        {
            m = atoi(str);
            break;
        }
        i++;
    }
    int * map;
    map = new (nothrow) int [n,m];
    //
    i = 0;
    char * temp;
    temp = new (nothrow) char [m];
    int j = 0;
    while(test.getline(str, 100))
    {
        cout &lt;&lt; str &lt;&lt; endl;
        if(i&lt;n)
        for(j = 0 ; j &lt; m ; j++)
        {
            /******
            // #=1, space=0, P=2, .=3 \\
            ******/
            if(str[j] == ' ')
                map[i,j] = 1;
            else if(str[j] == '#')
                map[i,j] = 0;
            else if(str[i,j] == 'P')
                map[i,j] = 2;
            else if(str[i,j] == '.')
                map[i,j] = 3;
            cout &lt;&lt; map[i,j];
        }
        cout&lt;&lt;endl;
        i++;
    }
    cout &lt;&lt; "----------------------------------------------" &lt;&lt; endl;
    for(i=0;i&lt;n;i++)
    {
        for(j=0;j&lt;m;j++)
        {
            cout &lt;&lt; map[i,j];
        }
        cout &lt;&lt; endl;
    }
    test.close();
    int a;
    cin&gt;&gt;a;
    return 0;
}
</code></pre>
