um how do I do a csls in C I might have asked this be4 but in that case I cant remember the answer and I cant find the topic anyway....
Printable View
um how do I do a csls in C I might have asked this be4 but in that case I cant remember the answer and I cant find the topic anyway....
system("cls");
Read the FAQ.
Clearing the screen
cls only works in DOS-WIN, in unix is clear. maybe try something like this
Then you just call, system(CLS);Code:#ifdef UNIX
#define CLS "clear"
#else
#define CLS "cls"
#endif
I`m using a unix so I should use clear then?
if you're using linux, you can use system("clear"); or use curses to make the job, example:
Code:#include <curses.h>
void clrscr(void)
{
static int init;
if (init == 0)
{
initscr();
init = 1;
}
clear();
refresh();
}
Or just convert this function from Pascal to C:
It'll clear the screen filling it with a color.Code:procedure Cls(Color : byte); assembler;
asm
mov AX, $A000 { move the video segment into AX cause }
mov ES, AX { you can't load a segment reg directly }
mov AL, [Color]
mov AH, AL { REG / REG is faster than MEM /REG }
mov CX, 32000 { 64k / 2 since we're using word values }
xor DI, DI { fast way of saying DI = 0 }
rep STOSW { mov ES:[DI], AL; dec CX, jcxz done }
end;
you guys cant make up for minds eh?