gpt4 book ai didi

windows-ce - Windows CE 上的 isatty

转载 作者:行者123 更新时间:2023-12-04 07:07:14 28 4
gpt4 key购买 nike

是否有等效于 isatty()在 Windows CE 上?换句话说,有没有办法在代码中检测 stdin/stdout/stderr 是否已被重定向?

最佳答案

你可以调用 GetStdIoPath(它在 coredll.dll 中——它没有在 MSDN 中记录,我不确定它是否在任何 SDK 头文件中,但你总是可以手动将它声明为 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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com