hi,
i found a lot of examples how to read data from one file but i can't understand how i do it by of InputStream and method read.
someone could give me a example ??
hi,
i found a lot of examples how to read data from one file but i can't understand how i do it by of InputStream and method read.
someone could give me a example ??
Hello stein,
here's an example (under the 'Solution' title):
http://wiki.forum.nokia.com/index.ph...rom_a_JAR_file
Regards,
r2j7
but now i have another problem case i can't access to the file i use this url = "file:///C:/myfile.txt"; but exception tells me that i have no permission to write there, can explain me how work directories on n70, i see a tutorial but only specifies the mai drive don´t talk about the directories that can be used
ty,
Hello stein,
Below's a quote from:
http://www.forum.nokia.com/info/sw.n..._0_en.zip.html
Based on the above, try something like:An example of a typical file URL in a S60 device looks as follows:
file:///C:/data/Images/Image(001).jpg
C:/data/myfile.txt
Regards,
r2j7
ty for your help, but i try what you suggest and don´t work, my code to save info on file:
can someone tell me what is wrong for the code give me exception and don´t let me write on file..Code:String url = "file:///c:/nokia/myfile.txt"; FileConnection conn = null; try { System.out.println("\na guardar informação-------------------------------------->1\n"); conn = (FileConnection) Connector.open( url,Connector.READ_WRITE ); if( conn.exists()==false ) conn.create();// create the file OutputStream out = conn.openOutputStream(); for (int i = 0; i < horaMiranda.length; i++) { out.write(this.horaMiranda[i].toString().getBytes()); System.out.println("\na guardar informação-------------------------------------->2\n"); } conn.close(); } catch( IOException e ){ System.out.println("\nERRO\n"); } catch( SecurityException e ){ System.out.println("\nNo permissions to write \n"); }
ty,
Hello stein,
String url = "file:///c:/nokia/myfile.txt";
Did you try using
String url = "file:///C:/data/myfile.txt";
or
String url = "file:///C:/Data/myfile.txt";
?
Regards,
r2j7
ty for help.
i try what you sad but don't works, i don't no that is important but i use s60 3rd edition sdk fp2 with s60 emulator. i have to change any option on emulator?
If you use emulator, try to put your file to the root folder of the emulator. For me it is
C:\Programme\Java\WTK25\appdb\DefaultColorPhone\filesystem\root\
Then you call
GreetingsCode:conn = (FileConnection) Connector.open( "file:///root/myfile.txt",Connector.READ_WRITE )
Ben
i follow your indications, but don´t work still say that i have no permission, whe i put the directory root give me a error but wasn't error of permission.
i use the listroot and the only directories that listed are:
Phone memory/
C:
i already add the options on java platform manager for read and write.
i need change any option, to permit write and read files?
any ideia to fix the problem??
Last edited by stein; 2008-03-13 at 22:43. Reason: more information
i really need help? i want to learn how works with files.
i had done everything and can't write the file case i don't have permission. i really need help?
You have to set the permissions in your jad file:
GreetingsCode:MIDlet-Permissions: javax.microedition.io.Connector.file.read, javax.microedition.io.Connector.file.write
Ben