Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!think.com!linus!nixbur!nixpbe!usun01!hoepfner From: hoepfner@usun01.UUCP (Andreas Hoepfner) Newsgroups: comp.lang.c Subject: Re: Unix Routines Message-ID: <439@usun01.UUCP> Date: 15 Jan 91 14:04:25 GMT References: <26284@uflorida.cis.ufl.EDU> Distribution: comp.lang.c Organization: Nixdorf Computer AG, Paderborn, Germany Lines: 41 In <26284@uflorida.cis.ufl.EDU> pm0@springs.cis.ufl.edu (Patrick Martin) writes: >Could someone tell me how to do the following on a Unix System: >Up() {will move the Cursor up 1 position} >Down() { ... down ...} >Left() { ... left ...} >Right() { ... right ...} >PS: I know I could use a system call to clear the screen but >I would prefer sending the direct ascii code to a printf >statement. Normaly, to do this on all possible terminal types, you should use the curses library. This is an easy way for vtxxx Terminals : #define up() printf("%cA",0x1b) #define down() printf("%cB",0x1b) #define right() printf("%cC",0x1b) #define left() printf("%cD",0x1b) #define home() printf("%cH",0x1b) #define CLS printf("\033[2J\033[H") #define setcur(a,b) printf("\033[%d;%dH",a,b) #define BELL printf("%c",0x07) :-) Andreas +-----------------------------------------------------------------------+ | Andreas Hoepfner | | | | paper mail: e-mail: | | Siemens Nixdorf Informations | | Systeme USA: hoepfner.kd@nixdorf.com | | Abt. PU 2222 !USA: hoepfner.kd@nixdorf.de | | Heinz Nixdorf Ring | | D-4790 Paderborn | | tel.: (+49) 5251 10-7479 | +-----------------------------------------------------------------------+