Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

writeInt problem within the array.

$
0
0
I having problem trying to write 3d array into the file. I don't understand why if I put in the exact Int then it able to write into my text file, but when I put in the array elements it doesn't. Please help thank you.

	private static void writeData(int[][][] data, String string) throws Exception {
		FileOutputStream os = new FileOutputStream("data.txt");
		DataOutputStream out = new DataOutputStream(os);
		int elements;
		

		for (int f = 0; f < data.length; f++) {
			for (int r = 0; r < data[f].length; r++) {
				for (int c = 0; c < data[f][r].length; c++) {
					elements = data[f][r][c];
					out.writeInt(99); // THIS WORK
					out.writeInt(elements); // THIS NOT WORK
					System.out.print(elements + " ");
				}
			}
		}

		os.close();
		out.close();
	}


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>