gpt4 book ai didi

c - 直接使用终端功能

转载 作者:太空狗 更新时间:2023-10-29 11:13:56 24 4
gpt4 key购买 nike

有没有人使用 terminfo 功能函数,例如 tputs()tparm()tigetstr()tigetnum() 直接了吗?

我在网上找不到这些低级终端功能的任何实际例子。

是否每个人都使用 ncurses 库来控制终端并且不关心这些低级代码?

我认为这段低级代码很难阅读。

我应该为这些低级代码烦恼,还是只学习 ncurses,后者对 ncurses 提供的高级代码来说不那么让人不知所措?

如果有人知道这些底层函数的一些实用信息,请与我分享。

最佳答案

Does everyone uses ncurses library to control terminal and doesn't bother with this low-level code?

这很容易检查。

首先,准备一个ncurses库中的函数列表。在我的系统上是:

nm -D /lib64/libncurses.so.5.9 | fgrep ' T ' \
| sed 's/^[0-9A-Fa-f ]*T //' > /tmp/ncurses-functions-list

现在看看在各种程序中使用了多少。

for f in /usr/bin/* ; do 
nm -D $f 2>/dev/null | fgrep ' U ' \
| sed 's/^ *U //' \
| fgrep -x -f - /tmp/ncurses-functions-list && echo ==== $f;
done

关于c - 直接使用终端功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25981376/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com