线覆盖 [英] Line overwriting

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

问题描述

我有一个C程序打印出如下两行:


第1行

第2行


我希望这个程序能够睡一秒钟,然后

再打印两行,覆盖前两行。睡觉位

是微不足道的,但覆盖怎么样?我假设输出

将显示在标准终端仿真器上,如xterm。

I have a C program that prints out two lines as follows:

Line 1
Line 2

What I would like is for this program to sleep for one second, and then
print out two more lines, overwriting the previous two. The sleeping bit
is trivial but, what about the overwriting? I am assuming that the output
will be displayed on a standard terminal emulator, like xterm.

推荐答案

在文章< ; pa *************************** @ sjones.org>,

Steven Jones< sj ** **@sjones.org>写道:
In article <pa***************************@sjones.org>,
Steven Jones <sj****@sjones.org> wrote:
我有一个C程序,打印出如下两行:

第1行
第2行

我想做什么就像是为这个程序睡了一秒钟,然后再打印出两行,覆盖前两行。睡觉的位是微不足道的,但覆盖怎么样?我假设输出
将显示在标准终端模拟器上,如xterm。
I have a C program that prints out two lines as follows:

Line 1
Line 2

What I would like is for this program to sleep for one second, and then
print out two more lines, overwriting the previous two. The sleeping bit
is trivial but, what about the overwriting? I am assuming that the output
will be displayed on a standard terminal emulator, like xterm.




请允许我成为第一个说这个的人 - 我从我的心灵的深处说出来,带着你在这个新闻组中获得的

有用帖子的所有善意和爱心:


不便携。不能在这里讨论。 Blah,等等,等等。



Allow me to be the first to say this - and I say it from the deepness of my
heart, with all the kindness and love one has come to associate with the
helpful posts you get in this newsgroup:

Not portable. Can''t discuss it here. Blah, blah, blah.


----- BEGIN PGP签名消息-----

哈希:SHA1


Steven Jones写道:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Steven Jones wrote:
我有一个C程序打印出如下两行:

第1行第2行

我希望这个程序能够睡一秒钟,然后再打印两行,覆盖前两行。睡觉的位是微不足道的,但覆盖怎么样?我假设输出
将显示在标准终端模拟器上,如xterm。
I have a C program that prints out two lines as follows:

Line 1
Line 2

What I would like is for this program to sleep for one second, and then
print out two more lines, overwriting the previous two. The sleeping bit
is trivial but, what about the overwriting? I am assuming that the output
will be displayed on a standard terminal emulator, like xterm.




printf(" \r"); fflush(stdout);

但是,虽然这适用于大多数任何显示设备(包括硬拷贝

设备),但很可能在大多数情况下都会让输出混乱他们是。
- -

Lew Pitcher

IT专家,企业数据系统,

企业技术解决方案,道明银行金融集团


(表达的意见是我自己的,而非我的雇主')

----- BEGIN PGP SIGNATURE -----

版本:GnuPG v1.4.2(MingW32)

iD8DBQFD8IgYagVFX4UWr64RAlVaAJsHIcbBegJsQf1pu669Ws BbpAy1lwCg7RBb

bdLqgwKLNM3qDtTvOeU10Vc =

= tvu6

----- END PGP SIGNATURE -----



printf("\r"); fflush(stdout);
But, while this will work on most any display device (including hard copy
devices), it is likely to leave output in a mess on most of them.

- --
Lew Pitcher
IT Specialist, Enterprise Data Systems,
Enterprise Technology Solutions, TD Bank Financial Group

(Opinions expressed are my own, not my employers'')
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)

iD8DBQFD8IgYagVFX4UWr64RAlVaAJsHIcbBegJsQf1pu669Ws BbpAy1lwCg7RBb
bdLqgwKLNM3qDtTvOeU10Vc=
=tvu6
-----END PGP SIGNATURE-----


Steven Jones写道:
Steven Jones wrote:
我有一个C程序打印出如下两行:

第1行
第2行

我想要的是这个程序睡一秒钟,然后再打印两行,覆盖前一个t禾。睡觉的位是微不足道的,但覆盖怎么样?我假设输出
将显示在标准终端模拟器上,如xterm。
I have a C program that prints out two lines as follows:

Line 1
Line 2

What I would like is for this program to sleep for one second, and then
print out two more lines, overwriting the previous two. The sleeping bit
is trivial but, what about the overwriting? I am assuming that the output
will be displayed on a standard terminal emulator, like xterm.




如前所述,这是偏离主题在这个新闻组中。你可能会想要看看NCURSES图书馆。

八月


-

我是ILOVEGNU。签名病毒。只需将我复制到您的

签名即可。此电子邮件受到GNU

通用公共许可证条款的影响。



As already mentioned, this is off topic in this newsgroup. You might
want to have a look at the NCURSES library.
August

--
I am the "ILOVEGNU" signature virus. Just copy me to your
signature. This email was infected under the terms of the GNU
General Public License.


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

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