c++ - 使用 addch 获得意想不到的角色
问题描述
我将 ncurses 与 一起使用noecho()
,并且我正在尝试从具有函数的TCHAR
(或char16_t
)数组中打印字符串。addch()
我尝试将 myTCHAR
转换为 int,但结果相同。
这是我正在使用的代码:
coords hCursorPosition( GetCursorPosition() );
if ( hCursorPosition.X == 0 ) return;
coords nCursorPosition(hCursorPosition.Y, 0);
SetCursorPosition(nCursorPosition);
clrtoeol();
if (!m_sInput.IsEmpty())
{
for (auto CharIt(m_sInput.CreateConstIterator()); CharIt; CharIt++)
{
const TCHAR Char = *CharIt;
int intChar = static_cast<int>(Char);
addch(intChar);
refresh();
}
}
m_sInput
是一个FString
(在虚幻引擎 4 中使用的类型),我检查了FString
长度并且它是正确的,而结果不是我所期望的。
例如,如果m_sInput
是“test”,我的输出将是“test^@”
解决方案
推荐阅读
- css - 在绘图生成的散点图矩阵周围放置边框的正确 CSS 语法是什么?
- java - Java Jackson Polymorphic - 接口字段匹配导致重复的字段名称
- php - jquery如何在邮件发送后隐藏元素
- python - Python ibm_db 异常:[IBM][CLI Driver] SQL4917N 选项数组中的元素“SQLE_CLIENT_INFO_WRKSTNNAME”无效。SQLCODE=-4917
- powershell - Powershell 加载二进制模块
- python - 无法在 Windows 10 上安装 Python 3.7.4 的 pip
- html - 使用 GreaseMonkey 从网站隐藏 DIV 的问题
- javascript - Javascript保持焦点并点击元素
- html - 将鼠标悬停在文本上时出现“淡入”效果的问题
- selenium - 金牛座代理问题