Windows CE 上是否有与 isatty()
等效的函数?换句话说,有没有办法在代码中检测 stdin/stdout/stderr 是否已重定向?
最佳答案
您可以调用 GetStdIoPath(它在 coredll.dll 中 - MSDN 中没有记录它,我不确定它是否在任何 SDK header 中,但您始终可以手动将其声明为 extern,链接器会找到它)。
这是我的 C# 版本 - 如果需要,您可以轻松地将其移植回 C:
[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
}
关于windows-ce - Windows CE 上的 isatty,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/926865/