在屏幕上获取字符 [英] get char on screen
问题描述
我查看了 NCurses 函数列表,但似乎找不到返回已打印在屏幕上的字符的函数.每个字符单元格中存储的字符是否有可访问的值?如果没有,Windows终端有没有类似的功能?
I've looked through the NCurses function list, and I can't seem to find a function that returns the characters already printed on the screen. Is there an accessible value for the char stored in each character cell? If not, is there a similar function in the Windows terminal?
我想用它来用不同的字符或新的属性替换屏幕上某个值的所有字符(例如:所有 a
's).
I want to use this to replace all the characters on the screen of a certain value (ex: all the a
's) with a different character, or with new attributes.
推荐答案
函数 inch()
获取字符并将其作为 chtype
返回.使用 winch()
从除 stdscr
之外的窗口获取字符.
The function inch()
gets the character and returns it as a chtype
. Use winch()
to get a character from a window other than stdscr
.
这篇关于在屏幕上获取字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!