有一个程序,在程序退出时,先在C:/windows下面一步一步生成一个score.txt的文本文件(在点“退出”前这个文件还不存在),随后上传到服务器中加密,再随后就自动删除,程序结束,历时2-4秒钟。 我的问题是:能不能在客户端删除前,就把这个score.txt中的几个分数读出来,但是确保内容完整(因为它是一点一点生成的,能不能在删除前的一刹那读出来) 我试着用以下程序实现,但是成功率不高: procedure TForm3.Timer3Timer(Sender: TObject); var str:string; begin if fileexists('c:/windows/score.txt') then begin tt:=1; str:=''; memo2.Lines.LoadFromFile('c:/windows/score.txt'); str:=copy(memo2.Lines[12],6,length(memo2.Lines[12])-5)+','; str:=str+copy(memo2.Lines[19],6,length(memo2.Lines[19])-5)+','; str:=str+copy(memo2.Lines[27],6,length(memo2.Lines[27])-5)+','; str:=str+copy(memo2.Lines[32],6,length(memo2.Lines[32])-5)+','; str:=str+copy(memo2.Lines[37],6,length(memo2.Lines[37])-5)+','; str:=str+copy(memo2.Lines[42],6,length(memo2.Lines[42])-5)+','; edit1.Text:=str; end else if tt=1 then begin timer3.Enabled:=false; clientsocket1.Address:='10.0.0.9'; clientsocket1.Open; sleep(500); sendpacket('A'+edit1.Text); clientsocket1.Close; application.Terminate; end; end; 各位高手,有没有更好的办法呢?(万无一失的办法)