Phr0zen_Penguin

POSIX Clear Screen

Aug 29th, 2014
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.87 KB | None | 0 0
  1. /*==================================================================================================
  2.   --------------------------------------------------------------------------------------------------
  3.   [posix_clear_screen.c]
  4.     The POSIX (Unix, Linux, Mac OSX, etc) way of clearing the terminal screen.
  5.  
  6.         (c) Damion 'Phr0z3n.dev' Tapper, 2014.
  7.         Email: [email protected]
  8.   --------------------------------------------------------------------------------------------------
  9.   ==================================================================================================*/
  10.  
  11. #include <unistd.h>
  12. #include <term.h>
  13.  
  14. void ClearScreen(void)
  15.  
  16. int main(void)
  17. {
  18.     ClearScreen();
  19.  
  20.     return 0;
  21. }
  22.  
  23. void ClearScreen(void)
  24. {
  25.         if(!cur_term)
  26.         {
  27.             int result;
  28.             setupterm(NULL, STDOUT_FILENO, &result);
  29.             if(result <= 0) return;
  30.         }
  31.  
  32.     putp(tigetstr("clear"));
  33. }
Advertisement
Add Comment
Please, Sign In to add comment