Article View: comp.std.c
Article #5039Re: Embedded Eacape Sequences ?
From: Bill Spitzak
Date: Sat, 20 Apr 1996 16:39
Date: Sat, 20 Apr 1996 16:39
34 lines
1451 bytes
1451 bytes
Stan Novinsky <stan_novinsky@jhuapl.edu> writes: >I have a program that I wish to have some escape sequences >defined and used. The escape sequences will work on a >VT emulation terminal I am using. >For instance, I want to place the cursor at the top left >corner of my terminal screen with ESC//'[01;01H'. >This works in FORTRAN by defining the > > ESC = CHAR(27) > TOPL = ESC//'[01;01H' You can put these characters in string constants and then print them. The main secret is that the ESC character is '\033' or equivalently '\x1b' or char(27). The closest equivalent to the above in Ansi C would be: #define ESC "\033" const char *topl = ESC"[01;01H"; Since this depends on the string constant appending which you might not have, just doing: const char *topl = "\033[01;01H"; might be what you want. You are likely to get a lot of messages saying "use curses" or other things to that effect. Just ignore them, that is obviously not what you want. Bill
Technical Details
Message-ID:
<4lb40v$r04@hollywood.cinenet.net>Path:
arc1-ca.pugleaf.net!news.cinenet.net!not-for-mailReferences:
<4l80bq$b2k@aplinfo.jhuapl.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.cinenet.net!not-for-mail From: spitzak@cinenet.net (Bill Spitzak) Newsgroups: comp.std.c Subject: Re: Embedded Eacape Sequences ? Date: 20 Apr 1996 09:39:59 -0700 Organization: Cinenet Communications,Internet Access,Los Angeles;310-301-4500 Message-ID: <4lb40v$r04@hollywood.cinenet.net> References: <4l80bq$b2k@aplinfo.jhuapl.edu> NNTP-Posting-Host: hollywood.cinenet.net X-Newsreader: NN version 6.5.0 #3 (NOV)