BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 08-25-2008, 02:15 PM   #1
jcher
New Member
 
Join Date: Aug 2008
Model: 9000
PIN: N/A
Carrier: Kechen networks
Posts: 1
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
RemyJ
CrackBerry Addict
 
Join Date: May 2005
Location: Golden, CO US
Model: 9700
Carrier: ATT
Posts: 684
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



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Measurement Computing 197728B USB 1608HS-2A0 16-Channel Digital DAQ +2 Analog picture

Measurement Computing 197728B USB 1608HS-2A0 16-Channel Digital DAQ +2 Analog

$422.50



Schneider PLC TWIDO TM2AMM6HT ANALOGUE I/O MODULE 20mA 24VDC Missing Terminal picture

Schneider PLC TWIDO TM2AMM6HT ANALOGUE I/O MODULE 20mA 24VDC Missing Terminal

$156.00



New PCI-MIO-16E-4 Data Acquisition Card With 16 Analog Input Channels for NI picture

New PCI-MIO-16E-4 Data Acquisition Card With 16 Analog Input Channels for NI

$311.00



1PC × PR ELECTRONIC 2211 ANALOG CALCULATOR PR2211EC2A2 Ser.No. 885175 picture

1PC × PR ELECTRONIC 2211 ANALOG CALCULATOR PR2211EC2A2 Ser.No. 885175

$85.00



Measurement Computing 2-Channel 12-bit Analog Output Board CIO-DAC02 picture

Measurement Computing 2-Channel 12-bit Analog Output Board CIO-DAC02

$299.99



computer board picture

computer board

$1250.00







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