I'm confused. Delving into the CMemFile code, it looks like the internal CMemFile buffer is NULL, which means that (memory shortage problems aside) the rich edit control has never called the callback to write to the file. It might be worth putting a breakpoint before the offending line and taking a look at the memFile member variables to see if there is indeed a valid looking buffer in there! If there is no buffer, it could be down to where you are calling the function from - could it be at a point where the rich edit control might have already cleared down the content and started destroying itself? Just out of interest, what did you set GETCONTENT_BUFFER to? I set it to 4096. Sorry I can't be any more help!