[RESOLVED] Changing portion of a file
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: [RESOLVED] Changing portion of a file

  1. #1
    Join Date
    Oct 2010
    Location
    St Paul, MN
    Posts
    60

    [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
    Location
    UK
    Posts
    4,474

    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
    Location
    St Paul, MN
    Posts
    60

    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center