[ krle_zr @ 07.01.2010. 20:38 ] @
Izbacuje mi gorepomenutu gresku kada pokusam da upisem string u tekstualni file.

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;



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.
[ savkic @ 07.01.2010. 21:11 ] @
> ... ali siguran sam da je zatvoren, cak ga i ponovo dodelim datotecnoj promeljivoj da bih bio siguran.

Neko ga onda drži otvorenim, ako si siguran da to nisi ti, downloaduj Unlocker i on će ti tačno reći koji program je u pitanju.
[ krle_zr @ 07.01.2010. 22:00 ] @
Reseno. Ipak je bila datoteka otvorena negde u kodu.

Hvala.
Pozdrav