×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    44

    Erasing the contents of a file

    Hi

    I want to know how to delete the contents of a file, so it can be rewritten fully using JavaME.

    Should I delete the file, and create it anew? Or is there a method to empty a file?

    I currently can read it, but the contents matter not after the first read, and must be renewed in full after.

    Thank you.

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,556

    Re: Erasing the contents of a file

    truncate()

  3. #3
    Registered User
    Join Date
    Oct 2010
    Posts
    44

    Re: Erasing the contents of a file

    Quote Originally Posted by petrib View Post
    truncate()
    Would that be, truncate(0)?

  4. #4
    Regular Contributor
    Join Date
    Mar 2011
    Location
    Pune,Maharashtra,India
    Posts
    92

    Re: Erasing the contents of a file

    Quote Originally Posted by tuxette View Post
    Would that be, truncate(0)?
    Truncates the file, discarding all data from the given byte offset to the current end of the file.

  5. #5
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,556

    Re: Erasing the contents of a file

    Quote Originally Posted by tuxette View Post
    Would that be, truncate(0)?
    Yes, of course. I just gave enough of a hint for anyone to look it up in the documentation. Have to leave something for the actual developer to do, too.

Similar Threads

  1. Read contents of SMS file
    By carlyle in forum General Messaging
    Replies: 4
    Last Post: 2008-08-15, 18:14
  2. please please help me show contents of file txt
    By finalcomp in forum Symbian
    Replies: 1
    Last Post: 2006-07-17, 12:36
  3. please please help me show contents of file txt
    By finalcomp in forum Symbian User Interface
    Replies: 7
    Last Post: 2006-07-16, 20:44
  4. secure sis file contents
    By BlueLava in forum Digital Rights Management & Content Downloading
    Replies: 12
    Last Post: 2006-04-18, 00:53
  5. need to display the file contents?
    By yuva69 in forum Symbian
    Replies: 0
    Last Post: 2002-06-19, 09:47

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×