询问一个从文件输入初始化二维数组的有关问题

询问一个从文件输入初始化二维数组的问题
#include <iostream>
#include <fstream>
using namespace std;

ifstream inFile("test.txt");


int main ()
{
char Maze[10][10];
for(int a=0;a<=9;a++)
{
for(int b=0;b<=9;b++)
inFile>>Maze[a][b];
}
return 0;
}


test里是一个迷宫用零表示墙
0000000000
0 0 0 0
0 0 0 0
0 00 0
0 000 0
0 0 0
0 0 0 0
0 000 00 0
00 0
0000000000

调试时Maze[a][b]一直显示的是-52,不知道为什么没能初始化这个二维数组.

------解决方案--------------------
fscanf(fp, "%d", &temp); 把temp保存到数组中就是了

先读到一个一维数组中,将一维数组中的数据copy到二维数组中
------解决方案--------------------
中间的空格好像没有被输入.
#include<iostream>
#include<fstream>
using namespace std;

ifstream inFile("test.txt");


int main ()
{
char Maze[10][10];
for(int a=0;a <=9;a++)
{
for(int b=0;b <=9;b++)
inFile>>Maze[a][b];
}
for(int a=0;a <=9;a++)
{
for(int b=0;b <=9;b++)
cout<<Maze[a][b];
cout<<endl;
}
return 0;
}
输出结果:
jinlingjie@linux:~/Desktop> ./try
0000000000
0000000000
0000000000
0000000000
0000000000
0000��HK�
K�F�
��▒K�
���޷��
(K��

------解决方案--------------------
C/C++ code
#include <iostream > 
#include <fstream > 
#include <string>
using namespace std; 

ifstream inFile("test.txt"); 



int main () 
{ 
    char Maze[10][10]; 
    for(int a=0;a  <=9;a++) 
    { 
        string str;
        if(getline(inFile, str))
        {
            memcpy(Maze[a], str.c_str(), 10);
        }
    } 
    for(int a=0;a  <=9;a++) 
    { 
        for(int b=0;b  <=9;b++) 
            cout <<Maze[a][b]; 
        cout <<endl; 
    } 
    return 0; 
}

------解决方案--------------------
#include <iostream > 
#include <fstream >
#include <string>
using namespace std; 

ifstream inFile("test.txt"); 


int main () 

char Maze[10][10];
string temp;
for(int a=0;a<=9;a++) 

getline(inFile,temp);
for(int b=0;b<=9;b++) 
{
Maze[a][b]=temp[b];
}
}
for(int a=0;a<=9;a++) 

for(int b=0;b<=9;b++) 
{
cout<<Maze[a][b];
}
cout<<endl;
}
int k;
cin>>k;
return 0; 

这样就正常显示了。