isatty on windows CE

孤街浪徒 提交于 2019-12-24 05:36:08

问题


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?


回答1:


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
}


来源:https://stackoverflow.com/questions/926865/isatty-on-windows-ce

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!