ファイルのバックアップ先を選択できるバックアップ プログラムを作成しようとしています。ファイルの場所を保存しても問題ありませんが、それを読み取ることが問題です。
保存方法
public static void write(String importdest) throws IOException {
// Create some data to write.
String dest = importdest;
// Set up the FileWriter with our file name.
FileWriter saveFile = new FileWriter("Q'sSavesConfig.cfg");
// Write the data to the file.
saveFile.write(dest);
// All done, close the FileWriter.
saveFile.close();
}
可変荷重方式
public static String read() throws IOException {
String dest;
BufferedReader saveFile = new BufferedReader(new FileReader("Q'sSavesConfig.cfg"));
// Throw away the blank line at the top.
saveFile.readLine();
// Get the integer value from the String.
dest = saveFile.readLine();
// Not needed, but read blank line at the bottom.
saveFile.readLine();
saveFile.close();
// Print out the values.
System.out.println(dest + "\n");
System.out.println();
return dest;
}
私の主な問題は
System.out.println(dest + "\n")
「null」を出力しますが、「Q'sSavesBackup.cfg」に保持されている情報をロードすることになっています
誰かがこれを修正する方法を教えてもらえますか?