如何清除显示 [英] how to clear display

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

问题描述

大家好,在显示器上打印时,我想删除最后打印的行并用新字符串替换它。


我的疑问将通过以下示例更好地解释。

Hi all, while printing on a monitor, I want to remove the last printed line and replace it with a new string.

My doubt will be better explained with the following example.

展开 | 选择 | Wrap | 行号

推荐答案

您可以在打印下一行之前使用clrscr清除整个屏幕。


是要清除整个屏幕还是只清除指定的行
You can use clrscr to clear the entire screen before printing next line.

Do you want to clear the entire screen or only specified line


如果要清除最后一行,那么你可以使用,

int main()

{

printf(" ; Hello \ n");

system(" cls"); //调用cls命令。

printf(" Test \ nn);;

返回0;

}

希望你能找到这个。
if meant to clear uptil the last line then you can use,
int main()
{
printf( "Hello\n");
system( "cls" ); // calls the cls command.
printf( "Test\n");
return 0;
}
Hope you are looking for this.


这两种方法都依赖于C库或操作系统的标准功能。


但是你能做的就是在测试结束时放一个空格

Both of those methods rely on on standard features of either the C library or the OS.

But what you could do is put a space on the end of Test

展开 | 选择 | Wrap | 行号


这篇关于如何清除显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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