clear screen function

This is a discussion on clear screen function within the C Programming forums, part of the General Programming Boards category; Originally Posted by SpudNuts Code: system("cls"); Can that be placed anywhere within your code? Technically, yes, but it would be ...

  1. #16
    Helper
    Join Date
    Jun 2004
    Posts
    255
    Quote Originally Posted by SpudNuts
    Code:
    system("cls");
    Can that be placed anywhere within your code?
    Technically, yes, but it would be a serious coding mistake, from the maintenance point of view. Not portable things should be abstracted so that they are defined only once.

    Maintenance hell:
    Code:
    system("cls");
    <...>
    system("cls");
    <...>
    system("cls");
    <...>
    system("cls");
    Maintenance heaven:
    Code:
    void cls(void)
    {
       system("cls");
    }
    
    <...>
    cls();
    <...>
    cls();
    <...>
    cls();
    <...>
    cls();
    See the difference ?
    Emmanuel Delahaye

    "C is a sharp tool"

  2. #17
    Registered User
    Join Date
    Dec 2004
    Location
    Oklahoma City
    Posts
    55
    Gotcha, thanks

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 09:56 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  4. Clear Screen Function?
    By Punkture in forum C Programming
    Replies: 3
    Last Post: 05-05-2003, 10:25 PM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 06:06 PM

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