(C++) I've created a function to open the text file and assign the contents to an array. The first 2 elements in the array are the size of the grid. However, if either or both of the first 2 numbers are double digits, it doesnt read them in as double digits. Is there any way of doing this?
int openMap()
{
    std::string fileName;
    std::cout << "Please enter the file name with extension that you want to open: ";
    std::cin >> fileName;
    system("CLS");
    std::ifstream file(fileName);           //OPENS MAP FILE
    int tmp;
    int i = 0;
    if (!file.is_open())                    //CHECKS IF THE MAP FILE HAS OPENED CORRECTLY
    {
        std::cout << "Error Occured!\nCould not open file.";
        return 0;
    }
    while (!file.eof())                     //READS THE MAP FILE AND PASSES THE INFORMATION INTO AN ARRAY
    {
        file >> tmp;
        checkNumber(tmp);
        if (valid == true)                  //IF THE CHARACTER IS NOT A NUMBER THEN IT WONT BE PASSED INTO THE ARRAY
        {
            tmpArray[i] = tmp;
            i++;
            valid = false;
        }
        row = tmpArray[1];              //ASSIGNS THE FIRST 2 NUMBERS OF THE MAP FILE TO ROW AND COL VARIABLES
        col = tmpArray[0];
    }
    return row, col;
}
I would assume I have to rewrite
file >> tmp
in some sort of different way, but not sure how. Is there a way to scan through the text file until it hits a whitespace?
The text file contents looks like this
6 4 0 0 1 0 0 0 2 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0 3 0
(the 6 or 4 or both can be double digits instead)
Edit:
    for (int j = 0; j < row; j++)
    {
        for (int k = 0; k < col; k++)
        {
            _map[j][k] = tmpArray[l];
            std::cout << _map[j][k] << " ";
            l++;
        }
    }   
 
     
     
    