CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2006
    Posts
    96

    Angry can i modify a file without load the file in?

    hi guys,

    if i have a very large binary file, i only need to modify only value inside, can i do this without loading the file in? how?

    thanks.

  2. #2
    Lindley is offline Elite Member Power Poster Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+)
    Join Date
    Oct 2007
    Location
    Fairfax, VA
    Posts
    10,861

    Re: can i modify a file without load the file in?

    Presuming you're replacing a fixed number of bytes at a known byte offset with the same number of bytes, you can simply seek to that location and write over what's there.

    If you want to write a different number of bytes than are present at that location, you'll need to read in at least the part of the file after that, so you can write it out again bumped over to the right place.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

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



HTML5 Development Center

Click Here to Expand Forum to Full Width