BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 08-25-2008, 02:15 PM   #1 (permalink)
New Member
 
Join Date: Aug 2008
Model: 9000
PIN: N/A
Carrier: Kechen networks
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Offline  
Old 08-25-2008, 10:28 PM   #2 (permalink)
CrackBerry Addict
 
Join Date: May 2005
Location: Golden, CO US
Model: 9700
Carrier: ATT
Posts: 684
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can't read the pc filesystem directly but you can tell the simulator to map the SDCard to a directory on the PC. You can then access a file there by "file:///SDCard/...."
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

UU1: Vintage Apple Powerbook Low Power AC Adapter ADP-17AB
$24.99
UU1: Vintage Apple Powerbook Low Power AC Adapter ADP-17AB pictureVintage Apple Darlin's Weekly Memo Note Pad 52 Sheets SEALED 1970's
$9.5
Vintage Apple Darlin's Weekly Memo Note Pad 52 Sheets SEALED 1970's pictureApple Macintosh IIcx M5850 - Vintage
$36.44
Apple Macintosh IIcx M5850 - Vintage pictureVintage Apple & Pear Fruit Firmness Tester
$25.0
Vintage Apple & Pear Fruit Firmness Tester  picture4 Boxes of Vintage Apple M2658G/A Color Inkjet Transparencies LTR 20 Sheets NIB
$20.0
4 Boxes of Vintage Apple M2658G/A Color Inkjet Transparencies LTR 20 Sheets NIB  picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.