第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

console.cs IsHandle重定向的奇數(shù)

console.cs IsHandle重定向的奇數(shù)

C#
一只萌萌小番薯 2021-04-28 09:09:23
MS自己的console.cs具有以下功能,由IsInput / Output / ErrorRedirected API使用。private static bool IsHandleRedirected(IntPtr ioHandle) {    // Need this to use GetFileType:    SafeFileHandle safeIOHandle = new SafeFileHandle(ioHandle, false);    // If handle is not to a character device, we must be redirected:    int fileType = Win32Native.GetFileType(safeIOHandle);    if ((fileType & Win32Native.FILE_TYPE_CHAR) != Win32Native.FILE_TYPE_CHAR) // <--- ??        return true;    // We are on a char device.    // If GetConsoleMode succeeds, we are NOT redirected.    int mode;    bool success = Win32Native.GetConsoleMode(ioHandle, out mode);    return !success;}我不明白(由我自己)標(biāo)記的那一行的邏輯// <--- ??。,這是有道理的if (fileType != Win32Native.FILE_TYPE_CHAR) return true;,但是& Win32Native.FILE_TYPE_CHAR在進(jìn)行比較之前,我不明白為什么它被掩蓋了。更令人困惑的FILE_TYPE_CHAR是,常量是0x0002也由共享的單個(gè)位FILE_TYPE_PIPE = 0x0003,因此,如果文件句柄指向管道,則所if討論的語句將不會(huì)return true;(GetConsoleMode此后可能依賴于失?。浚?。對(duì)于為什么以這種方式編寫代碼的任何見解,將不勝感激。謝謝。
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 163 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)