Je cherche a lire le contenu d'un fichier .txt et de l'inserer dans un tableau[][]. Je n'arrive qu'à le faire partiellement. Est-ce que quelq'un pourrait m'éclairer pourquoi ou me mettre sur la bonne voie.
source.txt
0100100100
0101100110
0100000000
0001111110
1001001100
1011000001
1000001100
1011011000
0010010110
1000000000
resultat
0100100100
0101100110
0100000000
0001111110
1001001100
1011000001
1000001100
1011011000
0010
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 try { BufferedReader in = new BufferedReader(new FileReader(filename)); for (int a=0; a<maze.length; a++) { for (int b=0; b<maze[0].length; b++) { maze[a][b] = (char)in.read(); System.out.print(maze[a][b]); } } opened = true; in.close(); } catch (FileNotFoundException e){System.out.println("File Not Found !");} catch (IOException e){System.out.println("I/O Exception !");} }while(!opened);
Partager