TERMCAP与参数 [英] Termcap with parameters

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

问题描述

我编码一个壳状的C和我要实现的在线编辑功能,我已经实现了它的基本的,现在我要实现Ctrl + L键从而清除然后屏幕显示提示和行我正在研究。

I am coding a shell-like in C and I want to implement the line edition functionality, I already implemented the basic of it, now I want to implement ctrl+l which clear the screen then display the prompt and the line I was working on.

我需要使用的termcap:

I need to use the termcap :

CM字符串将光标定位在直线l,列c。

'cm' String to position the cursor at line l, column c.

我的问题是如何将我传递变量L和C的的termcap?

My question is how to I pass the variable l and c to the termcap ?

推荐答案

假设你有厘米存储能力 term_cm 变量。然后,你将替代使用 tgoto 函数的参数:

Suppose you have the cm capability stored in the term_cm variable. Then you would substitute parameters using the tgoto function:

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

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

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