CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Oct 2010

    [RESOLVED] Changing portion of a file

    I have a file where I need to append a checksum to the beginning. How would this be done? I don't think it's possible to insert data, so I can allocate space by writing 512 0s, but how would I overwrite them later?

  2. #2
    Join Date
    May 2006

    Re: Changing portion of a file

    You can use java.io.RandomAccessFile or if the file is short it may be easier to rename the existing file, create a new file with the old filename and then write the data to append followed by the data in the renamed file. Finally you can delete the renamed file or if it's renamed to *.bak keep it as a previous version of the file.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  3. #3
    Join Date
    Oct 2010

    Re: Changing portion of a file

    Okay. Thank you!

Tags for this Thread

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.