Posted by webmaster Guido on March 08, 2007
In Reply to Re: debug Delphi: I/o error 6 and 32 posted by webmaster Guido on
March 03, 2007
: I have a short program that reads some text files then encrypts them. I occasionally
get I/O error 6 or 32. Heres my code:
: [source code here, see previous message]
In the copy below of the first lines of your FormCreate procedure, I marked and commented the lines that can cause errors. Please let me know if this info solved your problem :)
procedure TForm1.FormCreate(Sender: TObject);
var
SR: TSearchRec;
Done: string;
FName: string;
InFile: textfile;
LineofText: TextLines;
i: integer;
DotheEncryption: Boolean;
begin
DotheEncryption := False;
Twofish1.InitialiseString('JanDunn');
If FindFirst('*.doc', faAnyFile, SR) = 0 then
FName := SR.Name;
{ But... if FindFirst did NOT find a file, then
FName doesn't contain a valid filename ! }
AssignFile( InFile, Fname );
{ If FName doesn't contain a valid filename, then
InFile now points to a non-existing file }
Reset(Infile);
for i := 1 to 5 do begin
{ If InFile points to a non-existing file, then
the next line will give an I/O error 6 }
Readln(Infile, LineofText[i]);
end;
// etc...
end;
Related articles
Follow Ups
Post a Followup
DelphiLand Club members: enter your Membership password.
Guests can get a Forum Guest password by subscribing to the DelphiLand Newsletter.