Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User dineshk's Avatar
    Join Date
    Apr 2008
    Posts
    43
    Hi all,

    I want to write the data to a separate file using fileconnection. Is it posssible?

  2. #2
    Nokia Developer Champion jappit's Avatar
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,391
    Sure, with FileConnection API you can write files. Maybe this Wiki article can help you:

    http://wiki.forum.nokia.com/index.ph...tion_&_PIM_API

    Pit

  3. #3
    Registered User dineshk's Avatar
    Join Date
    Apr 2008
    Posts
    43
    Quote Originally Posted by jappit View Post
    Sure, with FileConnection API you can write files. Maybe this Wiki article can help you:

    http://wiki.forum.nokia.com/index.ph...tion_&_PIM_API

    Pit

    Hi

    String url = path + name;
    String string = textbox.getString();
    byte data[] = string.getBytes();
    FileConnection fconn = (FileConnection)Connector.open("file://d:/readme.txt;append=true", Connector.READ_WRITE);
    if (!fconn.exists()) {
    fconn.create();
    }
    OutputStream ops = fconn.openOutputStream();
    ops.write(data);
    ops.close();
    fconn.close();
    } catch (IOException ioe) {
    System.out.println("IOException: "+ioe.getMessage());
    } catch (SecurityException se) {
    System.out.println("Security exception:" + se.getMessage());
    }

    This is the code i have tried. There is no error in the application. While execution java.lang.IllegalArgumentException: Root is not specified. This msg is displayed. Please tell me if any modification needed.

  4. #4
    Nokia Developer Champion jappit's Avatar
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,391
    If you're testing on WTK emulator you should use its root path, so file path
    becomes: "file:///root1/readme.txt"

    To check for emulator filesystem go to: <WTK_ROOT_PATH>\appdb\<EMULATOR_NAME>\filesystem\

    Pit

  5. #5
    Registered User dineshk's Avatar
    Join Date
    Apr 2008
    Posts
    43
    Quote Originally Posted by jappit View Post
    If you're testing on WTK emulator you should use its root path, so file path
    becomes: "file:///root1/readme.txt"

    To check for emulator filesystem go to: <WTK_ROOT_PATH>\appdb\<EMULATOR_NAME>\filesystem\

    Pit
    Hi

    I have replaced the path. Now during execution
    To avoid potential deadlock, operations that may block, such as
    networking, should be performed in a different thread than the
    commandAction() handler. This warning msg is displayed.

  6. #6
    Nokia Developer Champion jappit's Avatar
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,391
    Hi Dinesk,

    try searching Forum for your doubts, since many answers are already there:

    http://discussion.forum.nokia.com/fo...d.php?t=131778

    Pit

  7. #7
    Registered User dineshk's Avatar
    Join Date
    Apr 2008
    Posts
    43
    Quote Originally Posted by dineshk View Post
    Hi

    I have replaced the path. Now during execution
    To avoid potential deadlock, operations that may block, such as
    networking, should be performed in a different thread than the
    commandAction() handler. This warning msg is displayed.
    Thanks a lot. I have added textbox in the same application. Now i want to save the datas that are added in the textbox into the separate file using fileconnection.

Similar Threads

  1. Data read & write in a file
    By Aliencse in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2008-04-08, 07:18
  2. File server: Compilation error in carbide.c++
    By justteam in forum Symbian C++
    Replies: 6
    Last Post: 2007-01-03, 23:44
  3. write and read binary data to file
    By sunny_singh in forum Symbian C++
    Replies: 0
    Last Post: 2005-10-18, 10:01
  4. Replies: 1
    Last Post: 2005-05-26, 14:22
  5. Resource as a data file
    By alchabitius in forum Mobile Java General
    Replies: 2
    Last Post: 2003-09-28, 07:44

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