i got Run-Error 5 lazarus / 13-General ---------------------------------------------------------------------- alanlam2009 · 2008-01-30 12:22 (http://windshadow.lam.googlepages.com/problem.jpg) QuoteOS : Windows XP SP2 LZR : Lazarus Version #0.9.24 beta Code: [Select]procedure Tsummaryer.Button2Click(Sender: TObject); begin       phrase_dict_kw := 'A';       cal_phrase := 0;       i := 1;       while ord(phrase_dict_kw) <= 90 do          begin               phrase_dict_path := 'dict\phrase'+phrase_dict_kw+'.dict';               assignfile(phrase_dict, phrase_dict_path);               reset(phrase_dict);               repeat                     assignfile(file_get, 'data\temp2.attica');                     reset(file_get);                     readln(dict_content);                     {while not(eof(file_get)) do                           begin                                readln(essay_content);                                while length(copy(essay_content, i, length(dict_content))) > 0 do                                      begin                                           check_content := copy(essay_content, i, length(dict_content));                                           if (check_content = dict_content) then                                              begin                                                   cal_phrase := cal_phrase +1 ;                                                   memo2.text := memo2.text + dict_content +' FOUND';                                              end;                                              i := i+1;                                      end;                           end;}                     closefile(file_get);               until eof(phrase_dict);               closefile(phrase_dict);               ord(phrase_dict_kw) := ord(phrase_dict_kw)+1;          end; end; i have the file 'dict\phraseA.dict'-'dict\phraseZ.dict' already Can anyone help me? ---------------------------------------------------------------------- Bart · 2008-01-30 15:38 Runtime Error 5 means Access denied. The file maybe readonly and you use the wrong (default) filemode, or you try to re-open the file with a new filehandle without having closed it before (somewhere in the while and repeat loops possibly you assignfile more then once, then the reset fails?). Step through the code to see where exactly the runtime error occurs. You might also consider tesing if file IO succeded before trying to do something with the data. Either use exceptions, or use the {$I-} and {$I+} compiler directives and check IOResult after each File IO. Hope this helps a little? Bart ---------------------------------------------------------------------- alanlam2009 · 2008-01-30 15:57 Thank a lot~