请与ncurses的显示文本 [英] get the text in the display with ncurses

查看:149
本文介绍了请与ncurses的显示文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法找回输出到?

Is there any way to get back the characters outputted into a variable on ncurses ?

让我们说我做的:

printw("test");

然后,我希望能够为:

then I want to be able to:

somefunc(strbuffer);
printf("%s",strbuffer); // test

我需要一个函数来找回屏幕上的所有字符转换为一个变量,scr_dump得到的接近,但输出格式为不可读。

I need a function to get back all characters on the screen into a variable, scr_dump get's close but the output format is unreadable..

推荐答案

如果你把东西用诅咒功能在屏幕上(如addch,mvaddch,addstr),可以使用 inchstr 和相关函数从屏幕读取字符。

If you put stuff on the screen using curses functions (e.g. addch, mvaddch, addstr) you can use inchstr and related functions to read the characters from the screen.

然而,如果你用printf或屏幕(包括系统调用来使用诅咒另一个程序),您将无法阅读屏幕内容的思想促进文本任何其他非诅咒的方法。

However, if you use printf or any other non-curses method of puting text on the screen (including a system call to another program that uses curses) you will not be able to read the content of the screen.

诅咒在内部保持当前屏幕内容和inchstr函数使用屏幕内部重新presentation找到的当前内容。

Curses maintains the current screen contents internally and the inchstr functions use the internal representation of the screen to find the current contents.

这篇关于请与ncurses的显示文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆