Replace write in fstream

From: Jon Slaughter (nobody_at_nowhere.com)
Date: 12/29/04


Date: Tue, 28 Dec 2004 22:22:07 -0600

I'm trying to replace some bytes in a file using fstream but all I seem to
be able to do is append or 0 the file then write... Basicaly I just need to
replace the first 512 bytes of the file with some buffer(but eventually I
will need to replace random blocks in the file at different locations). Is
there anyway to do this efficiently using fstream? (I know I can duplicate
the file, but it seems a waste to rewrite the same data for no reason).

Thanks.



Relevant Pages

  • Re: What is the replacement for ios::noreplace in std?
    ... The calling program for my function where the <fstream> code is, ... places a header as the first line in that file and the results on the next line. ... it exists and then opening the file for append just did not work. ... reason the append did not work and the line after the header just keep getting ...
    (comp.lang.cpp)
  • Re: stl::fstream O_RDWR | O_CREAT
    ... > Which ios_base flags does one use to open an fstream for ... > I do NOT necessarily want to truncate or append to the file. ...
    (comp.lang.cpp)
  • Re: Replace write in fstream
    ... > I'm trying to replace some bytes in a file using fstream but all I seem to ... but it seems a waste to rewrite the same data for no ... > reason). ...
    (comp.lang.cpp)
  • Re: VMR 9 in VS.NET 2003
    ... but you know for some reason the same thing just didnt work ... I guess the reason was that I had to remove the header from one of the ... text9, ticker9 samples run fine without the fstream, iostream thingy) ... Do i have to include a particular library dependency for fstreams, ...
    (microsoft.public.win32.programmer.directx.video)
  • fstreams, iostreams in vmr-9 project (dot net 2003)
    ... but you know for some reason the same thing just didnt work ... I guess the reason was that I had to remove the header from one of the ... text9, ticker9 samples run fine without the fstream, iostream thingy) ...
    (microsoft.public.win32.programmer.directx.video)