Lazarus is a shit about opening text files lazarus / 13-General ---------------------------------------------------------------------- Antony · 2004-12-10 00:46 I have this code Code: [Select]                      assignFile(tf, flnm);                      {$I-}                        reset(tf);                      {$I+}                              if IORESULT <> 0                      then return := ERROR                      else begin                                      ....                             end; in a function, and the exact code in another function, BUT, in one of those functions IT DOES NOT WORK while executing I receive invalid dile handler... any suggestion? ---------------------------------------------------------------------- Adam.Pilorz · 2004-12-10 08:35 Well, I had never any problems opening text files realy... And on the other hand it is not Lazarus, only Free Pascal Compiler, what can eventualy create such problem. Lazarus is only IDE and graphical component's library, nothing more. I suggest that you should put this question in a Free Pascal forum or mailing list, but first try to compare twice that codes in different situations (try both when the file exist and both, when not). ---------------------------------------------------------------------- Lightning · 2004-12-14 13:29 This was discussed before, search the forum. I strongly suggest using higher level components, they are easier to use and safer. See StringList, Memo, etc. You can load a file with just one line of code, manipulating strings is also verry easy. Lazarus is as "shit" as Delphi is, personally i find it easy to use for simple tasks like loading files ---------------------------------------------------------------------- Adam.Pilorz · 2004-12-15 15:17 Well, using higher level components have one bad thing: You must load whole file to memory, what can be very unwanted when the file is big and you don't need to load all the file to get your informations. But AssignFile works fine to me... ---------------------------------------------------------------------- RudieD · 2004-12-15 16:27 Antony, Instead of just Reset why don't you use ... if FileExists(flnm) then  {--   Reset(tf)  {-- Open File--} else   Rewrite(tf); {-- Create File --} ... ---------------------------------------------------------------------- Lightning · 2004-12-17 12:28 Streams are high level components and extremly fast, useful for many kinds of data manipulation including text, hmm i had no problems using the pascal way for text files :?: I do little text output, mostly settings wich can be stored in ini or xml files, sometimes streams for fast low level processing, almost all components use streams to load and save data/text so i think it's the best way to go if you can't use the existing components.