【发布时间】:2019-07-03 20:07:01
【问题描述】:
我正在使用带有noecho() 的ncurses,并且我正在尝试使用addch() 函数从TCHAR(或char16_t)数组中打印一个字符串。
我尝试将 TCHAR 转换为 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^@”
【问题讨论】:
-
您在 Windows 上,对吗?这可能会有所帮助:Display wchar_t using ncurses
标签: c++ linux ncurses unreal-engine4