Dave's Brain

Browse - Programming Tips - How can I set whether a file handle is inherited by a child process?

Date: 2010may10
OS: Windows
Language: C/C++
Keywords: inherit, inherits

Q.  How can I 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); }

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.