gpt4 book ai didi

c - 带参数的 Termcap

转载 作者:太空宇宙 更新时间:2023-11-04 02:49:35 25 4
gpt4 key购买 nike

我正在用 C 编写类似 shell 的代码,我想实现行编辑功能,我已经实现了它的基本功能,现在我想实现 ctrl+l 清除屏幕然后显示提示和我的行正在研究。

我需要使用 termcap :

'cm' 将光标定位在 l 行 c 列的字符串。

我的问题是如何将变量 l 和 c 传递给 termcap ?

最佳答案

假设您将 cm 功能存储在 term_cm 变量中。然后您将使用 tgoto 函数替换参数:

char *s = tgoto (term_cm, c, l);
tputs (s, 1, putchar);

关于c - 带参数的 Termcap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23581397/

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