On Unix, everything is a file, so you can use file i/o functions with pipes, files, sockets, etc. But on windows, the api you use depends on the type of i/o HANDLE you have.
My question is: given a HANDLE how do you determine what the underlying type is? For example, I have a HANDLE that's either real file, or a named/anonymous pipe. I'd like to know whether PeekNamedPipe can be called on this HANDLE.
Use GetFileType. Check for a return value of FILE_TYPE_PIPE.
http://msdn.microsoft.com/en-us/library/aa364960(VS.85).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With