how to create file using j2me?

Share

salamu alikom
-did any one know how to create file using j2me?
i write the following code & it executed without any error or exception
but when i go to see the file i didn't find it(this means it isn't created)

String path="file:///root1/mytxt.txt";
FileConnection fc=(FileConnection)Connector.open(path);
if(!fc.exists())
fc.create();
DataOutputStream dos = fc.openDataOutputStream();
dos.write(post_msg,0,post_msg.length);
dos.close();
fc.close();

-did any one know an emulator which ca recore amr voice??

Gazakom Alllah 7'iran

use this file path ==> "file://sdfsd/root1/" and it will work isA :)

Best wishes,
Shimaa

Eman, if you are working on the emulator, try this path:
Go to wth and you will find appdb.Open it you will find
C:\WTK22\appdb\DefaultColorPhone\filesystem\ ===> root1
so your path should begin
"file://root1/" not "file://sdfsd/root1/"

Try both and tell me the results! Abeer

 

See this from Nokia Forum about FileConnection API (JSR 75)

 

example of url in real deplyment "file:///C:/Nokia/Images/Image(001).jpg", and both my previous reply and Abeer reply worked correctly on the emulator.

Shimaa