Możesz wrzucić fragment kodu?
Nigdy coś takiego mi się nie przydarzyło. Zwykle daję mniej więcej taki kod:
var
p: TextFile;
begin
AssignFile(p, 'c:qq.txt');
Rewrite(p);
Write(p, 'fasf');
CloseFile(p);
DeleteFile('c:qq.txt');
end;
I wszystko gra.
Dorzucam fragment kodu
unit Ruc2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm2 = class(TForm)
Label1: TLabel;
Memo1: TMemo;
Edit1: TEdit;
Edit2: TEdit;
Label2: TLabel;
Button1: TButton;
Edit3: TEdit;
Label3: TLabel;
Label4: TLabel;
Edit4: TEdit;
Label5: TLabel;
Image1: TImage;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
Kartpasp=record
oddz: string[25];
naz: string[25];
nrfab: string[15];
nrrej: string[15];
DTECH: array[1..200] of string[40];
end;
Tbp=file of Kartpasp;
var
Form2: TForm2;
plp: Tbp;
pln: Tbp;
psp:kartpasp;
npsp:kartpasp;
cep,fname: string[30];
implementation
uses MAIN;
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
var
i,ip: integer;
label x1,x2,y;
begin
if Main.z=1 then
begin
Assignfile(plp,'c:\zdt\paszport.ruc'); {żródlo}
reset(plp);
Assignfile(pln,'c:\zdt\paszrob.ruc'); {wynik modyfikacji}
rewrite(pln);
y: if not eof (plp)then
begin
read(plp,psp);
if pasp.nrrej=edit4.text then
begin
npsp.oddz:=form2.edit1.text;
npsp.Naz:= form2.edit2.text; {z celi?}
npsp.Nrfab:= form2.edit3.text;
npsp.Nrrej:= form2.edit4.text;
for i:=1 to 200 do begin npasp.Dtech[i]:=form2.Memo1.lines[i-1]; end;
write(pln,npsp);
end else
begin
write(pln,psp);
end;
goto y;
end;
closefile(plp); {staryplik}
If ioresult 0 then
begin
Case ioresult of
2 : cep:='File not found ...';
3 : cep:='Path not found ...';
5 : cep:='Access denied ...';
6 : cep:='Invalid handle ...';
8 : cep:='Not enough memory ...';
10 : cep:='Invalid environment ...';
11 : cep:='Invalid format ...';
18 : cep:='No more files ...';
else cep:='Unknown Error #'+inttostr(ioresult);
end;
end;
If ioresult 0 then showMessage( cep);
closefile(pln); {Po modyfikacji jest dobrze}
{$I-}
Fname:='c:\zdt\paszport.ruc' ;
DeleteFile(Fname); { i ni cholery plik sobie siedzi dalej}
If ioresult 0 then
Jan