0

演習として hexeditor を作成しようとしましたが、ファイルを書き込みモードで開こうとすると、プログラムが常にエラーを返すことがわかりました。ここに私のプログラムセグメントがあります:

try {
    byte[] buffer={(byte) 0xfe, (byte) 0xfe};

    out = openFileOutput(filename.toString(), 0);



    out.write(buffer, 0x50, 2);
    out.write(buffer, 0x5c, 2);
    out.write(buffer, 0x64, 2);
    out.write(buffer, 0x290, 2);

} catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
finally {
    if (out != null) {
        try {
            out.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
4

0 に答える 0