Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User stein's Avatar
    Join Date
    Jul 2007
    Posts
    41
    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 ??

  2. #2

  3. #3
    Registered User stein's Avatar
    Join Date
    Jul 2007
    Posts
    41
    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,

  4. #4
    Nokia Developer Moderator r2j7's Avatar
    Join Date
    Aug 2007
    Posts
    1,595
    Hello stein,

    Below's a quote from:

    http://www.forum.nokia.com/info/sw.n..._0_en.zip.html

    An example of a typical file URL in a S60 device looks as follows:
    file:///C:/data/Images/Image(001).jpg
    Based on the above, try something like:

    C:/data/myfile.txt

    Regards,
    r2j7

  5. #5
    Registered User stein's Avatar
    Join Date
    Jul 2007
    Posts
    41
    ty for your help, but i try what you suggest and don´t work, my code to save info 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");
            }
    can someone tell me what is wrong for the code give me exception and don´t let me write on file..



    ty,

  6. #6
    Nokia Developer Moderator r2j7's Avatar
    Join Date
    Aug 2007
    Posts
    1,595
    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

  7. #7
    Registered User stein's Avatar
    Join Date
    Jul 2007
    Posts
    41
    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?

  8. #8
    Registered User ben-efiz's Avatar
    Join Date
    Jan 2008
    Posts
    7
    Quote Originally Posted by stein View Post
    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

    Code:
    conn = (FileConnection) Connector.open( "file:///root/myfile.txt",Connector.READ_WRITE )
    Greetings
    Ben

  9. #9
    Registered User stein's Avatar
    Join Date
    Jul 2007
    Posts
    41
    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

  10. #10
    Registered User stein's Avatar
    Join Date
    Jul 2007
    Posts
    41
    i really need help? i want to learn how works with files.

  11. #11
    Registered User stein's Avatar
    Join Date
    Jul 2007
    Posts
    41
    i had done everything and can't write the file case i don't have permission. i really need help?

  12. #12
    Registered User ben-efiz's Avatar
    Join Date
    Jan 2008
    Posts
    7
    You have to set the permissions in your jad file:

    Code:
    MIDlet-Permissions: javax.microedition.io.Connector.file.read, javax.microedition.io.Connector.file.write
    Greetings
    Ben

Similar Threads

  1. Read from a text file
    By razas in forum Symbian C++
    Replies: 4
    Last Post: 2010-12-06, 05:53
  2. [announce] PyUIQ. Python for UIQ 2.1 and 3.x
    By OscarBernabeu in forum Python
    Replies: 35
    Last Post: 2008-01-17, 09:12
  3. Unable to read file DRM forward lock
    By gpalvia in forum Symbian C++
    Replies: 0
    Last Post: 2007-11-21, 03:58
  4. File reading & writing help, wav file redaing help
    By shubhamlahoti in forum Mobile Java General
    Replies: 6
    Last Post: 2007-06-27, 09:07
  5. How to read file and get token?
    By seera in forum Symbian C++
    Replies: 5
    Last Post: 2006-10-10, 10:16

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved