Ncurses和C ++字符串连接无法正常工作

我正在尝试使用ncurses在项目之间显示状态栏,就像大多数终端程序一样。

到目前为止,我有以下代码:

#include <iostream>
#include <cmath>
#include <string>
#include <curses.h>

using namespace std;

int main() {
    initscr();
    start_color();

    init_pair(3,COLOR_WHITE,COLOR_RED);

    getch();
    attron(COLOR_PAIR(3));

    string a = "--- Tickets: 455";

    a.append(70,'-');

    mvprintw(LInes-1,a.c_str());

    getch();

    endwin();
}

mvprintw应该输出屏幕的整个宽度,直到右边界为止。但实际上,仅附加了一个“-”。

我不确定这是否是ncurses问题,或者字符串是否未正确转换为c样式字符串。有人可以帮我找出问题吗?

zjytianlang 回答:Ncurses和C ++字符串连接无法正常工作

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3039409.html

大家都在问