This is VC++ 6.0 code running on a Windows Server 2003 SP2 machine.
1. I launch an external exe from my code using CreateProcess()
2. This process creates a file on disk
3. I do rc = WaitForSingleObject(procInfo.hProcess,INFINITE);
4. rc is returned as WAIT_OBJECT_0
5. int result = _stat( strDestFile, &buf ) where strDestFile is the file from step #2
6. I get buf.st_size as 0. However, when I execute the same exe as in step 1 standalone from a console window, it generates the file fine and it's not empty.
QUESTION: is it possible that _stat is returning incorrect info? Is there a more reliable way to check for non-0 size? Is there a way to check whether strDestFile has been properly closed by the external exe?