opening and reading files on PC using Blackberry simulator
Please Login to Remove!
Hi,
I'm trying to write code to open a gzip file using the simulator. I keep getting a null pointer error.The file is stored on the C:\ drive on the PC. Below is the code we are using. Not sure if there is a solution but any help would be appreciated. I'm not sure if the simulator can access files on the PC. If not, is there an alternate solution? By the way, then null pointer occurs at "if(!fconn.exists())"
Thanks,
J
int length;
String filename = "file:///C:/workspace/gzip_test_app/test.txt.gz";
FileConnection fconn = null;
try {
fconn = (FileConnection) Connector.open(filename, Connector.READ);
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
if (!fconn.exists())
{
Dialog.alert("The file does not exist!");
}
else {
Dialog.alert("File has been foudn");
Last edited by jcher; 08-25-2008 at 02:16 PM..
Reason: update
|