tw0896.pp 664 B

12345678910111213141516171819202122232425262728293031323334
  1. var
  2. dat,dat2 : file of byte;
  3. j : longint;
  4. Buffer,Buffer2 : Array[0..2047] of byte;
  5. begin
  6. for j:=0 to 2047 do
  7. Buffer[j]:=j and $ff;
  8. Assign(dat,'tbug896.tmp');
  9. Rewrite(dat,1);
  10. for j:= 0 to 2047 do
  11. write (dat,Buffer[j]);
  12. Close(dat);
  13. Assign(dat2,'tbug896a.tmp');
  14. Rewrite(dat2);
  15. for j:= 0 to 2047 do
  16. write (dat2,Buffer[j]);
  17. Close(dat2);
  18. Reset(dat);
  19. Reset(dat2,1);
  20. for j:=0 to 2047 do
  21. begin
  22. read(dat,Buffer[j]);
  23. read(dat2,Buffer2[j]);
  24. if Buffer[j]<>Buffer2[j] then
  25. begin
  26. Writeln('Error in typed file handling');
  27. Halt(1);
  28. end;
  29. end;
  30. Close(dat);
  31. close(dat2);
  32. end.