Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User studioj's Avatar
    Join Date
    Mar 2008
    Posts
    23
    Hi

    Is there an easy way to append strings at the end of a file?

    I saw somewhere "filename.txt;append=true" as file name but i cant believe that would work... (tested it too)

    Your help will be apreciated

  2. #2
    Nokia Developer Moderator petrib's Avatar
    Join Date
    Mar 2003
    Posts
    9,415
    Use fileSize() to get the size of the file.

    Then when you want to write to it, use openOutputStream() with an argument that sets the offset to the end of the file (size of the file) and start writing.

    If you set the parameter (offset) to the maximum value of a long, then you don't need to get the size/length of the file. The SDK docs for JSR-75 and this method says: "If the provided offset is larger than or equal to the current file size, the OutputStream is positioned at the current end of the file for appending."

  3. #3
    Registered User studioj's Avatar
    Join Date
    Mar 2008
    Posts
    23
    Quote Originally Posted by petrib View Post
    Then when you want to write to it, use openOutputStream() with an argument that sets the offset to the end of the file (size of the file) and start writing.

    and how can i put the offset parameter in the openOutputStream()??

    like this??:
    Code:
    openOutputStream(offset)

  4. #4
    Nokia Developer Champion jitu_goldie's Avatar
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330
    FileConnection connection = ()Connector.open(url,Connector.write);
    OutputStream stream = connection.openOutputStream(long byteOffset) ;
    stream.write(byte[]);
    stream.flush();
    stream.close();
    connection.close();
    stream = null;
    connection = null;

    check and reply..
    thanks,
    jitu_goldie..

    KEEP TRYING..

Similar Threads

  1. Regarding BMCONV
    By sanah007 in forum Symbian C++
    Replies: 2
    Last Post: 2009-05-26, 12:47
  2. Error with makesis.exe and creating the .pkg file
    By gramya87 in forum Symbian Tools & SDKs
    Replies: 7
    Last Post: 2007-10-10, 13:53
  3. Contacts fields order??
    By timatima in forum Symbian C++
    Replies: 1
    Last Post: 2007-06-08, 13:51
  4. Code Signing Certificates with File Connection Api
    By Rozik in forum Mobile Java General
    Replies: 1
    Last Post: 2007-05-30, 22:26
  5. file connection api vs signing
    By Rozik in forum Mobile Java General
    Replies: 1
    Last Post: 2007-05-15, 19:52

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