watery87 0 Light Poster

hi guys, am currently coding a multi threaded program to solve a maze. But firstly im having trouble saving the maze into 2d array. Any help is much appreciated

#include <stdlib.h>
#include <iostream>
#include <stdio.h>
#include <fstream>
using namespace std;


void getMaze()
{
fstream readMaze("mazedata.txt");
string templine, line;
while(getline(readMaze, templine))
    {
        line.append(templine);
        ofstream myfile;
  	myfile.open ("abcde.txt");
  	myfile << line;
    }
  
    }


int main()
{
    fstream readMaze("mazedata.txt");  //fstream the source file to be use.
     //mainmenu variable to get out of loop, respond is to get user choice.
    getMaze(); //declare object class
    string Val, ValChange, date; //Val = Value of index, ValChange = Value for index change, date = date of the index as at.
    cout << "Please wait while checking for source file...\n" << endl;
    if (readMaze.is_open()) //check to see if we could find the source file.
    {
        //Source file is found.
        cout << "File Found!" << endl;
        cout << "\n\nPress Enter to continue." << endl;
        system("read enterkey"); //pause function for linux based system. windows uses system("pause").
        getMaze(); //calls function in getMaze class to "getline" and append strings to "line" variable
        readMaze.close(); //close the source file, not required anymore, since data is already stored into memory.
        }
 }

mazedata.txt

Length : 20
Breadth : 10

// ------------------------------
// ----- Start of Maze Data -----
// ------------------------------
// 'S' denotes Starting position  
// 'E' denotes Ending position
// '#' denotes Barrier
// 'X' denotes Danger Area

####################
#S #  #            #
#  # ##   ##  ### ###
#     #   #   #  E #
## #  # X #  X  ## #
#   X ### #####    #
# #   #   #  #   ###
# ### ### ## # #####
#  #               #
####################