Currently, i am working with some exercises with Pascal's unit. I try to create my own Readln but unsuccessful.
Unit DOCXAU;
INTERFACE
uses crt;
TYPE xau= STRING[100];
var c : char;
s : xau;
function nhap : xau;
IMPLEMENTATION
function nhap : xau;
begin
s:='';
repeat
c:=ReadKey;
if ((c=#8) and (s<>'')) then
begin
delete(s,length(s),1);
end;
if ((c<>#8) and (c<>#13)) then
begin
write(c);
s:=s+c
end;
until c=#13;
nhap:=s;
end;
END.
Otherwise the final result is acceptable but when backspacing the cursor goes back with undeleted character.
Really needs suggestions..
Thanks in advance
Daravuth KEU