Thanks for all the suggestions. It was indeed nothing to do with the code I'd posted but had to do with a subroutine which added elements to a dynamic array.
I rewrote the subroutine and it now works fine. 2009/4/14 waldo kitty <[email protected]>: > Dave Coventry wrote: >> Hi, I'm having a problem with the following code: >> >> Fstr:=TFileStream.Create('data',fmOpenRead); >> i:=0; >> while i<Fstr.Size do >> begin >> b:=Fstr.ReadByte; >> inc(i); >> ............. Stuff ...................... >> end; >> Fstr.Free; <-- Exception raised here >> >> Do TFileStream objects not have to be freed? > > did you close Fstr after the while loop? the above doesn't show it... > > -- > NOTE: NEW EMAIL ADDRESS!! > > _\/ > (@@) Waldo Kitty, Waldo's Place USA > __ooO_( )_Ooo_____________________ telnet://bbs.wpusa.dynip.com > _|_____|_____|_____|_____|_____|_____ http://www.wpusa.dynip.com > ____|_____|_____|_____|_____|_____|____ ftp://ftp.wpusa.dynip.com > _|_Eat_SPAM_to_email_me!_YUM!__|_____ wkitty42 -at- windstream.net > _______________________________________________ > Lazarus mailing list > [email protected] > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > _______________________________________________ Lazarus mailing list [email protected] http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
