uses dos,crt,filehandle;

type chat=record
     name:String[20];
     talk:string[70];
     end;

var f:file;
    r:chat;
    c:string;
    old:longint;
    T:STRING;
begin
nassign(f,'chat.dat');
r.name:=paramstr(1);
r.talk:='';
old:=filesize(F);
CLRSCR;
GOTOXY(1,23);
TEXTBACKGROUND(1);
CLREOL;
TEXTATTR:=7;
repeat
GOTOXY(1,24);
CLREOL;
TEXTATTR:=7;

readln(C);
if old<>filesize(F) then BEGIN
                         NSEEK(F,OLD);
                         NREAD(F,T,SIZEOF(t));
                         GOTOXY(1,3);
                         CLREOL;
                         WRITELN(T);
                         OLD:=FILESIZE(f);
                         END;
NSEEK(F,FILESIZE(F));
NWRITE(F,C,SIZEOF(c));
OLD:=FILESIZE(f);
until C='/QUIT';
close(f);
end.