uses graph, crt;
var col,Driver,mode: smallint;
PROCEDURE ReadlnXY(X, Y: Integer; VAR S: String);
{$V-} {Relax string checking}
VAR
Ch: Char; { key from keyboard }
Done: boolean; { our flag for quiting }
CurColor: word; { color to write text in }
OldX: Integer; { old x }
BEGIN
S := '';
CurColor := GetColor;
MoveTo(X, Y);
Done := False;
WHILE NOT Done DO
BEGIN
Ch := Readkey; { get a single key }
CASE Ch of
#0: { extra key - two chars - let's ignore them }
Ch := Readkey;
#13: { return key }
Done := true; { we got our string, let's go }
#32..#126: { ASCII 32 (space) through 126 (tilde) }
BEGIN
OutText(Ch);
S := Concat(S, Ch);
END;
#8: IF Length(S) > 0 THEN
BEGIN
{ move back to last character }
OldX := GetX - TextHeight(S[Length(S)]);
MoveTo(OldX, GetY);
{ over write last character }
SetColor(0);
OutText(S[Length(S)]);
SetColor(CurColor);
MoveTo(OldX, GetY);
{ remove last character from the string }
Delete(S, Length(S), 1);
END;
END;
END;
END; { ReadlnXY }
var s: string;
begin
Driver := D8bit; mode := m800x600;
InitGraph (Driver,mode,'');
readlnxy (100,100,s);
readln;
end.