On Wed, Aug 27, 2008 at 1:08 AM, vitamin <wineforum-user@xxxxxxxxxx> wrote: Code like what you posted works. What does not work apparently is tee and 3>&1 1>&2 2>&3 Yes there were bugs and something I don't understand. 1) My logic bug: There was no need to call the following before my code block -- I thought I was being cautious. (The MTAPI says to call it after). My app seems to be working fine now without this initial HeapFree. if (g_pTrades != NULL) ::HeapFree(hHeap, 0, g_pTrades); 2) I don't understand why there is a problem having what I thought was a safety HeapFree call since I'm checking that g_pTrades != NULL. >From MSDN If this pointer is NULL, the behavior is undefined. But the if statement should guard for that. No? I'm not even going to bother putting in braces for the "after" call, but I'm not understanding why I seemed to be getting heap corruption (when I had the "before" call) when I'm not even supposed to be calling it due to the guarded if statement. From MSDN Calling HeapFree twice with the same pointer can cause heap corruption if (g_pTrades != NULL){ ::HeapFree(hHeap, 0, g_pTrades); }