Clearing the screen.

This is a discussion on Clearing the screen. within the C Programming forums, part of the General Programming Boards category; Since I use Linux, would you consider it bad programming practise to use STDIO.H's system() function to clear the screen ...

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    12

    Clearing the screen.

    Since I use Linux, would you consider it bad programming practise to use STDIO.H's system() function to clear the screen like this:

    Code:
    system("clear");
    I have arms?

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >would you consider it bad programming practise to use STDIO.H's system() function to clear the screen
    Yes. Since you're using Linux, and command line programs are typically written to be as considerate as possible toward other programs on Linux, you shouldn't be clearing the screen unless you own it (through curses or the X-Windows API). Rest assured that when your program throws away important output from previously called programs, the user will hate you.
    My best code is written with the delete key.

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    ... not to mention the confusing of which "clear" you're actually running. If you're going to system out a command, make sure you at least provide the full path:
    system("/usr/bin/clear");

    But, yeah, I agree with Prelude: you clear the screen and get rid of my previous output, and your program is dead meat!
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  4. #4
    Registered User
    Join Date
    Jun 2002
    Posts
    12
    Ok. Thanks. I was just porting an MS-DOS program to Linux, and I didn't know wether to keep the clrscr() function of conio.h in it to replicate it as much as possible. I guess I should just avoid clearing the screen then.
    I have arms?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 04:56 PM
  2. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM
  3. clearing the screen
    By ssharish in forum C Programming
    Replies: 2
    Last Post: 02-01-2005, 09:00 PM
  4. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 03:41 AM
  5. Clearing the screen
    By Shadow in forum C Programming
    Replies: 4
    Last Post: 05-23-2002, 02:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21