Posted By

Ktoso on 05/26/09


Tagged

hack clear console screen terminal printf


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

NyX
skammer


Hacky screen clearing through printf


 / Published in: C
 

A simple and hacky alternative for calling system("clear"); (which you really shouldn't use...). If you really have to get such an clear effect - use this snippet.

Although I realllly recommend using some lib to properly controll the terminal if you need such functions, for example ncurses http://pl.wikipedia.org/wiki/Ncurses or pdcurses http://pdcurses.sourceforge.net/ .

  1. #include <stdio.h>
  2.  
  3. int main(){
  4. printf("\033[2J\033[0;0f");
  5. printf("\033[%d;%df", 0, 0);
  6.  
  7. return 0 ;
  8. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: chcn001 on April 12, 2010

http://www.phpcoding.cn/2009/06/03/print-control-on-terminal-by-php/

control printer in php

Posted By: chcn001 on April 12, 2010

采用php开发终端字符界面 http://www.phpcoding.cn/2009/06/01/dev-terminal-by-php/

http://www.phpcoding.cn/2009/06/03/print-control-on-terminal-by-php/

You need to login to post a comment.