delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/30/07:18:21

From: kezman AT bigfoot DOT com (Kieran Farrell)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C amateur want to know how to clear a text screen.
Message-ID: <3750a551.95097825@news.pasteur.dialix.com.au>
References: <374f099e DOT 0 AT news1 DOT mweb DOT co DOT za> <FNH33.9208$Sm4 DOT 57791 AT weber DOT videotron DOT net>
X-Newsreader: Forte Agent 1.5/32.452
MIME-Version: 1.0
Organization: DIALix Internet Services
Lines: 34
Date: Sun, 30 May 1999 02:49:57 GMT
NNTP-Posting-Host: 203.12.3.8
X-Complaints-To: abuse AT telstra DOT net
X-Trace: nswpull.telstra.net 928032628 203.12.3.8 (Sun, 30 May 1999 12:50:28 EST)
NNTP-Posting-Date: Sun, 30 May 1999 12:50:28 EST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

conio.h is in my oppinion a great header, but there is another way to
clear the screen that can be adapted into a portable version. Try
this.

#include <stdio.h>
#include <process.h> /* Not sure if I spelled that right, oops */

void cls(void)
{
    system( "cls" );
    return;
}

What that basically does is ask the operating sytem to clear the
screen. As opposed to conio.h accessing the graphics card dirictly, to
make it portable, unix uses clear instead of cls. So something like
this MIGHT!!! work.

#ifdef (WIN32)
#define cls(void) system( "cls" )
#endif

#ifdef (UNIX)
#define cls(void) system( "clear" )
#endif

Someone who knows more about compiler commands might be able to
correct me if I'm wrong there since I just made it up, but it should
work *8).

>Try the function clrscr() from conio.h.
>> Can't find a library function to do that.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019