Le 4 octobre 2011 13:40, Frédéric Delanoy <[email protected]> a écrit :
> 2011/10/4 Dan Kegel <[email protected]>: > > + * handle_type: type of hIn handle > > + * 0 if file, 1 if console, anything else if unknown > (autodetect) > > > > I suspect you want an enum for that. > > Well I thought about that, but found it a bit overkill for such a > limited set of possible values. > Also, if I used sthg like > > enum CMD_HANDLE_TYPE { > CMD_HT_FILE = 0, > CMD_HT_CONSOLE = 1, > CMD_HT_UNKNOWN = 2 > } > > again, this is not needed (passing all thoses CMD_HT bits) static inline BOOL is_console_handle(HANDLE h) {return ((DWORD_PTR)h) & 3 == 3;} will test every handle and tell whether it's a console or a regular (file, pipe...) handle A+ > -- > -- > Eric Pouech >
