Google kaze:
I/O error 32 means "SHARING VIOLATION", in other words: you're trying to access a file which is in use by some other process (in your program or "locked" by another application).
... ali siguran sam da je zatvoren, cak ga i ponovo dodelim datotecnoj promeljivoj da bih bio siguran.

Evo koda:
Code:
function TForm1.Promeni(var Dat: TextFile): Integer;
var
S: String;
Pozicija, Krit: integer;
begin
if rdbLocal.Checked then Krit := 0 else Krit := 1;
AssignFile(Dat, Putanja);
Reset(Dat);
while not Eof (Dat) do
while not Eoln (Dat) do
begin
readln (Dat, S);
if (Pos(TrazS, S)) <> 0 then
begin
Pozicija := Pos(TrazS, S);
Delete(S, Pozicija +length(TrazS) +1, 1);
Insert(IntToStr(Krit), S, Pozicija +length(TrazS)+ 1);
break;
end;
end;
Closefile(Dat);
AssignFile(Dat, Putanja);
Rewrite(dat); // Ovde nastaje izuzetak
while not Eof (Dat) do
writeln(dat, S);
CloseFile(Dat);
Osvezi(Dat);
end;
function TForm1.Promeni(var Dat: TextFile): Integer;
var
S: String;
Pozicija, Krit: integer;
begin
if rdbLocal.Checked then Krit := 0 else Krit := 1;
AssignFile(Dat, Putanja);
Reset(Dat);
while not Eof (Dat) do
while not Eoln (Dat) do
begin
readln (Dat, S);
if (Pos(TrazS, S)) <> 0 then
begin
Pozicija := Pos(TrazS, S);
Delete(S, Pozicija +length(TrazS) +1, 1);
Insert(IntToStr(Krit), S, Pozicija +length(TrazS)+ 1);
break;
end;
end;
Closefile(Dat);
AssignFile(Dat, Putanja);
Rewrite(dat); // Ovde nastaje izuzetak
while not Eof (Dat) do
writeln(dat, S);
CloseFile(Dat);
Osvezi(Dat);
end;
U pitanju je tekstualna datoteka, koja ima samo jedan red, tj. dugacki string (duzi od 255) i potrebno mi je da izmenim samo jedan karakter.