[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
GETSXY
. Summary
getsxy(str <targets>, int <max>, int <x>, int <y>, int <color>);
. Description
The getsxy function is similar to the gets function, but the x,y lo-
cation of string entry may be specified, as well as a color at-
tribute. <buffer> is the string variable where the string should be
put, while <max> is the maximum number of characters the user may
enter (from 0 to 80). The cursor will be moved to <x>,<y>, and text
entered will use a color as described by <color>.
The user may edit the string as it is being entered, with the Left-
Arrow, Right-Arrow, Ctrl-Left-Arrow, and Ctrl-Right-Arrow keys as it
is being entered, and insert mode may be toggled on/off with the INS
key. String entry is over when the user presses Enter (Carriage Re-
turn on some computers). The user may press Esc to abort string en-
try, in which case the resulting string will have a length of 0.
Possible colors are numbered as follows:
Black 00
Blue 01
Green 02
Cyan 03
Red 04
Magenta 05
Brown 06
Light Grey 07
Dark Grey 08
Light Blue 09
Light Green 10
Light Cyan 11
Light Red 12
Light Magenta 13
Yellow 14
White 15
To obtain a color attribute value for a color combination, the for-
mula is
color attribute value =
foreground color value + (16 * background color value)
Therefore, a Yellow character on a Blue background would have a
color attribute value of 30 (14 + (16 * 1)).
. Return Value
The number of characters entered by the user are returned. If the
user pressed Esc to abort string entry, a value of -1 is returned.
. Example
int n;
str filename[64] = "C:\TELIX\TELIX.EXE";
// allow use to enter filename in black on white
// at current cursor position
n = getsxy(filename, 64, getx(), gety(), 112);
See Also:
gets
color chart
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson