![](/img/trans.png)
[英]telnet session sending 'F3' key to TcpClient using network stream
[英]How to convert the function key F3 to a byte array?
如何在C#中將功能鍵F3轉換為字節數組? 我們嘗試了下面的代碼,但是沒有用。
Secondcommand = "\x1bOR"; //F3
byte[] Bcommand_sec3 = System.Text.Encoding.ASCII.GetBytes(Secondcommand);
Obj_StreamOutput.Write(Bcommand_sec3, 0,Bcommand_sec3.Length);
嘗試跟隨
public static byte[] StrToByteArray(string hexValue) {
return Enumerable.Range(0, hexValue.Length)
.Where(x => x % 2 == 0)
.Select(x => Convert.ToByte(hexValue.Substring(x, 2), 16))
.ToArray();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.