是否可以在终端上以较慢的速度运行命令行程序?

时间:2021-07-13 02:23:45

I'm trying to debug a command line program I wrote. Specifically, the parts of it that prints to the terminal. It occurred to me that it could help if I somehow ran it slowly on the terminal.

我正在调试我编写的命令行程序。具体来说,就是打印到终端的部分。我突然想到,如果我在终端机上以某种方式缓慢地运行它,可能会有所帮助。

I'd like to be able to see how to terminal would print in older/less capable systems or whether there is flicker effect or not.

我想知道如何在较旧/性能较差的系统中打印终端,或者是否有闪烁效果。

Is there a way to run it slower? i.e. not insta-load it.

有没有办法让它跑得慢一点?即不insta-load。

Program: Written in "C", prints almost instantly.

程序:用“C”写,几乎立即打印。

OS: MacOSX/Windows/Linux, Any would work for me.

操作系统:MacOSX/Windows/Linux,任何一个都可以。

Thanks.

谢谢。

1 个解决方案

#1


0  

You can use the sleep function

你可以使用睡眠功能

#include <unistd.h>
//your code
sleep(1); // pauses for 1 second

by including many of those you get time to see what is happening with your program

通过包含其中的许多内容,您可以有时间了解您的程序正在发生什么

#1


0  

You can use the sleep function

你可以使用睡眠功能

#include <unistd.h>
//your code
sleep(1); // pauses for 1 second

by including many of those you get time to see what is happening with your program

通过包含其中的许多内容,您可以有时间了解您的程序正在发生什么