0
嗨夥計們,我在這裏粘貼了我的代碼。 Dialog.inform包含一個「長」值,這是一個玩家的分數。如果我想寫它到一個文件,我需要將它轉換爲字節的int。我正在將垃圾值寫入文件。可以幫助我解決這個問題嗎?我想打印內容(elapsed/34)寫入黑莓文件
Dialog.inform(「Congrats You scored:」+(elapsed/34));
try
{
FileConnection fc = (FileConnection)Connector.open("file:///SDCard/Rashmi.txt");
// If no exception is thrown, then the URI is valid, but the file may or may not exist.
if (!fc.exists())
{
fc.create(); // create the file if it doesn't exist
}
OutputStream outStream = fc.openOutputStream();
int lp=safeLongToInt(elapsed/34);
outStream.write("Rashmi".getBytes());
outStream.write(lp);
outStream.close();
fc.close();
再次謝謝...喬納森...它nworked :)我現在可以顯示名稱和分數:) – 2010-11-27 18:22:15