mxg2283@acf4.UUCP (meshulam gill) (01/09/85)
Does anybody know how to blank thhe screen using "C". I hhave been using line feeds but this is very slow. Is there a way to poke cls?
mxg2283@acf4.UUCP (meshulam gill) (01/09/85)
/* acf4:net.micro.pc / mxg2283@acf4.UUCP (meshulam gill) / 9:04 pm Jan 8, 1985 */ Does anybody know how to clear the screen using "C". I have been using line feeds but this is very slow. Is there a way to poke cls? /* ---------- */
dmt@ahuta.UUCP (d.tutelman) (01/11/85)
CC: dmt REFERENCES: <1050003@acf4.UUCP> The question of how to clear the screen from "C" programs is very dependent on the particular C you're using. However, a good way to do it in general is to exercise the BIOS call that sets the screen mode. Here's how. Using whatever your C uses to generate a program interrupt, call interrupt 10H, setting AH to 0 (Set Mode) and AL to whatever mode you want to be in after the ClearScreen (the mode for standard monochrome alphanumerics is 7). ALTERNATIVE: A less portable way, but maybe easier from your program, is to zero the display memory. Both the Alpha and Graphics displays are memory mapped to locations between B0000 and BFFFF hex. If you're only using one screen anyway (no background or hidden screens) and don't care about performance, zero the whole 64K. Otherwise, check the Tech Ref to see where in RAM your display is and zero it. (The latter is hardware dependent; it may not work from one manufacturer's display board to another, or from the monochrome to color board.) Happy hacking! Dave Tutelman
cib@lanl.ARPA (01/14/85)
> Does anybody know how to blank thhe screen using "C". > I hhave been using line feeds but this is very slow. > Is there a way to poke cls? The procedure suggested by Marc Meketon will not work under PC-DOS, since ascii 12 is a graphics character in that system. If you are running under PC-DOS, add ansi.sys to your config.sys file with "device = ansi.sys". Then from C issue the command printf("\033[H\033[2J"); Works fine for me. Charles cib@lanl
hohensee@uiucdcs.UUCP (01/15/85)
The easiest way, really, is to set your PC up with an ANSI device driver ... by including "DEVICE=ANSI.SYS" as a line in your CONFIG.SYS file. This will open a world of screen functions up to the programmer. Check out chapter 13 on Extended Keyboard functions in the DOS manual. Then to clear the screen simply: #define ESCAPE 27 clear_screen() { printf("%d[2J", ESCAPE); }
jhull@spp2.UUCP (01/19/85)
In article <24700095@uiucdcs.UUCP> hohensee@uiucdcs.UUCP writes: >The easiest way, really, is to set your PC up with an >ANSI device driver ... by including "DEVICE=ANSI.SYS" >as a line in your CONFIG.SYS file. This will open a >world of screen functions up to the programmer. Check >out chapter 13 on Extended Keyboard functions in the DOS >manual. > >Then to clear the screen simply: > >#define ESCAPE 27 >clear_screen() { printf("%d[2J", ESCAPE); } In the interest of keeping your programs a reasonable size, you might want to get into the habit of clear_screen() { puts("\027[2J"); } printf is pretty big. If it's not used elsewhere in your program, ... -- Blessed Be, Jeff Hull {ihnp4}trwrb!trwspp!spp2!jhull 13817 Yukon Ave. Hawthorne, CA 90250