有关屏幕控制的问题 [英] question concerning screen control

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

问题描述

我的问题是:是否有一种普遍接受的方式来清除屏幕

并可能将光标移动到新位置(除了换行符)

下一个printf在标准c中?

ANSI控制代码怎么样?大多数

平台的标准是什么?或者仅适用于基于PC / MAC的计算机?任何人都知道

哪里可以看到ANSI代码列表?


请赐教,谢谢你的时间。

My question is: Is there a generally accepted way to clear the screen
and perhaps move the cursor to a new location (other than newline) for
the next printf in standard c?

What about ANSI control codes? Are those standard across most
platforms? Or is that just for PC/MAC based computers? Anyone know
where I can see a list of ANSI codes?

Please enlighten me, thanks for your time.

推荐答案

在< 45 ********************** @ news.mindlink.netKenne th Lantrip< bo * *******@cmaaccess.com写:
In <45**********************@news.mindlink.netKenne th Lantrip <bo********@cmaaccess.comwrites:

我的问题是:是否有一种普遍接受的方式来清除屏幕

并且可能将光标移动到新的位置(除换行符之外)

标准c中的下一个printf?
My question is: Is there a generally accepted way to clear the screen
and perhaps move the cursor to a new location (other than newline) for
the next printf in standard c?



如果你真的*谈论标准C,那么没有。标准C没有

概念的屏幕。


如果你愿意有点不可移植,你的编译器可能会

a clrscr()函数。

If you''re *really* talking about standard C, then no. Standard C has no
concept of a "screen".

If you''re willing to be somewhat non-portable, your compiler might have
a clrscr() function.


ANSI控制代码怎么样?大多数

平台的标准是什么?或者仅适用于基于PC / MAC的计算机?任何人都知道

哪里可以看到ANSI代码列表?
What about ANSI control codes? Are those standard across most
platforms? Or is that just for PC/MAC based computers? Anyone know
where I can see a list of ANSI codes?



他们是相当标准的,是的。我会尝试谷歌搜索ansi escape

序列。


或者如果有curses的话。套餐可用于您的平台,您可以使用它。


-

John Gordon" ...你是他的父母和所有人,
go****@panix.com 我认为你可以信任轴#

他。 - Robert Chang,rec.games.board

They''re fairly standard, yes. I''d try googling for "ansi escape
sequences."

Or if there is a "curses" package available for your platform, you
might use that.

--
John Gordon "... What with you being his parents and all,
go****@panix.com I think that you could be trusted not to shaft
him." -- Robert Chang, rec.games.board


Kenneth Lantrip< bo ******** @ cmaaccess.comwrites:
Kenneth Lantrip <bo********@cmaaccess.comwrites:

我的问题是:是否有一种普遍接受的方式来清除屏幕

并且可能将光标移动到新位置(换行除外)

标准c中的下一个printf?
My question is: Is there a generally accepted way to clear the screen
and perhaps move the cursor to a new location (other than newline) for
the next printf in standard c?



No.请参阅comp.lang.c常见问题解答,< http://www.c-faq.com/> ;,问题19.4。


一个换页字符''\ f'',将*不*清除许多

系统的屏幕。


-

Keith Thompson(The_Other_Keith) ks***@mib.org < http: //www.ghoti.net/~kst>

圣地亚哥超级计算机中心< *< http://users.sdsc.edu/~kst>

我们必须做点什么。这是事情。因此,我们必须这样做。

No. See the comp.lang.c FAQ, <http://www.c-faq.com/>, question 19.4.

A formfeed character, ''\f'', will *not* clear the screen on many
systems.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.


>我的问题是:是否有一种普遍接受的方法来清除屏幕
>My question is: Is there a generally accepted way to clear the screen

>并且可能将光标移动到新位置(除了换行符)以便
标准c中的下一个printf?
>and perhaps move the cursor to a new location (other than newline) for
the next printf in standard c?



不在标准C中。许多系统都有curses和curses。库

处理此问题。

Not in Standard C. A number of systems have the "curses" library
which deals with this.


> ANSI控制代码怎么样?这些是大多数平台的标准吗?或者仅适用于基于PC / MAC的计算机?任何人都知道我在哪里可以看到ANSI代码列表?
>What about ANSI control codes? Are those standard across most
platforms? Or is that just for PC/MAC based computers? Anyone know
where I can see a list of ANSI codes?



ANSI控制代码仅在串行终端或仿真

符合它们时才有效。因此,如果程序在连接到拨号线的计算机上运行,​​那么如果这个人用ASR 33电传打字机拨打

,那你就不走运了。某种没有ANSI代码的CRT。

此外,MS-DOS控制台中的终端仿真非常粗糙

并且除非你加载否则不会执行ANSI控制代码ANSI.SYS。


curses库取决于用户告诉库它正在使用什么类型的

终端,并将其与描述相匹配控制

代码使用,库也相应调整。


许多终端仿真器模拟ANSI代码。如果你*必须*硬编码

转义序列,那些就是要使用的。那不是很多。

ANSI control codes only work if the serial terminal or emulation
thereof honors them. So if the program is running on a computer
connected to a dialup line, you''re out of luck if the guy is dialing
up with an ASR 33 Teletype or some kind of CRT without ANSI codes.
Also, the terminal emulation in the MS-DOS console is pretty crude
and doesn''t do ANSI control codes unless you load ANSI.SYS.

The curses library depends on the user telling the library what type of
terminal it is using, and matching it to a description of the control
codes to use, and the library adapts accordingly.

Lots of terminal emulators emulate ANSI codes. If you *must* hardcode
escape sequences, those are the ones to use. That''s not saying much.


>请赐教,谢谢你的时间。
>Please enlighten me, thanks for your time.



这篇关于有关屏幕控制的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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