public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Needing basic info on print position control
@ 2003-03-16 14:14 Andrew Lietzow
  2003-03-16 19:33 ` Stuart Longland
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Lietzow @ 2003-03-16 14:14 UTC (permalink / raw)
  To: gcc-help

Dear List,

Newbie looking for info on print position and screen position control.  I 
want the system to display something to an exact location on the screen, or 
on a printer.  

With Business Basic, one says something like:
print @(20,15) -- for screen control
and 
print @(20) for position control within the current line -- for print control

What does one do in gcc for this functionality?  I realize that this may be 
totally different for the screen when using proportional fonts but for a 
printer, if you are printing to forms, you need to use a non-proportional 
font in order to get the columns to line up properly.   

TIA,
Andrew L.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Needing basic info on print position control
  2003-03-16 14:14 Needing basic info on print position control Andrew Lietzow
@ 2003-03-16 19:33 ` Stuart Longland
  0 siblings, 0 replies; 2+ messages in thread
From: Stuart Longland @ 2003-03-16 19:33 UTC (permalink / raw)
  To: Andrew Lietzow; +Cc: gcc-help

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew Lietzow wrote:
> Dear List,
>
> Newbie looking for info on print position and screen position control.  I
> want the system to display something to an exact location on the
screen, or
> on a printer.
>
> With Business Basic, one says something like:
> print @(20,15) -- for screen control
> and
> print @(20) for position control within the current line -- for print
control
>
	For console (screen) under UNIX, most consoles here understand ANSI
escape sequences.  For example:

	^[[r;cH 	will position your cursor on row r, column C.  The r;c may be
ommitted, in which case, it will place the cursor at the top right hand
corner (row 1, column 1).

	You also have relative controls in ANSI:

	^[[xA	Up x rows
	^[[xB	Down x rows
	^[[xC	Right x columns
	^[[xD	Left x columns

	If x is ommitted, it's assumed to be 1.

	With the above examples, remember to replace ^[ with the ESCAPE
character (ASCII Character 27), so in a printf statement, to go to the
8th row, 20th column, use the following:

	printf("\033[8;20Hwhatever text goes here");

	Or with your example:
	printf("\033[15;20H");

	As for the printer, I think you'll find the backspace (^H) and space
are your friends.  ^H will go back a space, single space will go forward
a space.

	So in your example, make sure there's 15 spaces before your desired
text, like this:

	printf("                    Text starts here");

	Then, say, to go back to column 5, do this: (^H = character 8 or \010)
	printf("\010\010\010\010\010New text starts here");

	There are probably more efficient ways of doing this, this is what I know.
- --
+-------------------------------------------------------------+
| Stuart Longland           stuartl at longlandclan.hopto.org |
| Brisbane Mesh Node: 719             http://stuartl.cjb.net/ |
| I haven't lost my mind - it's backed up on a tape somewhere |
| Griffith Student No:           Course: Bachelor/IT @ Nathan |
+-------------------------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1-nr1 (Windows 2000)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+dIa3IGJk7gLSDPcRAkdhAJ4q/QkF1zgEsAbsLf2C/Bd7upvPbwCeJjVp
TOWKt3INBW7A8dslVtj+jIE=
=rAbE
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-03-16 14:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-16 14:14 Needing basic info on print position control Andrew Lietzow
2003-03-16 19:33 ` Stuart Longland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).