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