View Single Post
Old 11-25-2011, 01:35 AM   #11 (permalink)
bankkab
New Member
 
Join Date: Nov 2011
Model: 7100T
PIN: N/A
Carrier: Bike
Posts: 13
Post Thanks: 5
Thanked 0 Times in 0 Posts
Default Re: Read String in File text.

here this code

class Connect extends MainScreen {



Connect() {


FileConnection fc = null;
String fileContent = "";
try {
fc = (FileConnection)Connector.open("file:///D:/IP.txt");
if ( (fc==null) || !fc.exists()){
return "File does not exist";
}

InputStream in = fc.openInputStream();
byte[] data = IOUtilities.streamToBytes(in);
fileContent = new String(data);

in.close();
fc.close();
} catch (Throwable t) {

}
return fileContent;
}

}

it error " cannot return a value from method whose result type is void "

where is a void i don't declare a void function
Offline   Reply With Quote