The code runs without crashing, but when I look at the file afterwards in a hex editor, every byte (even those outside the range I thought I was writing to) are replaced with 00. I suspect I'm missing something in my understanding of file streams. Did I write that code correctly? Seekp does move the pointer over the next byte to be overwritten, yes? Am I getting a memory leak somewhere?