Programming Tips - Windows: set whether a file handle is inherited by a child process

Date: 2010may10 OS: Windows Language: C/C++ Keywords: inherit, inherits Q. Windows: set whether a file handle is inherited by a child process A. Use this function:
BOOL SetInherit(HANDLE h, const BOOL bInherit) { return SetHandleInformation(h, HANDLE_FLAG_INHERIT, bInherit ? HANDLE_FLAG_INHERIT : 0); }