tags:

views:

284

answers:

1

Is there an equivalent to isatty() on windows CE? In other words, is there a way to detect in code if stdin/stdout/stderr has been redirected?

+2  A: 

You could call GetStdIoPath (it's in coredll.dll - it's not documented in MSDN and I'm not sure if it's in any SDK headers, but you can always manually declare it as extern and the linker will find it).

Here's my C# version - you can easily port it back to C if necessary:

[DllImport("coredll.dll", SetLastError = true)]
public static extern int GetStdioPath(StdIoStream id, StringBuilder pwszBuf, int lpdwLength);

public enum StdIoStream
{
    Input = 0,
    Output = 1,
    ErrorOutput = 2
}
ctacke
I found GetStdioPathW() for wince and I think I can make it work. Thanks! Here's an MSDN link for reference:http://msdn.microsoft.com/en-us/library/aa908796.aspx
krupan