Am 04.11.2013 22:30, schrieb PICCORO McKAY Lenz: > i have several I/O write and i wish to know what its the best choice: > > 1) If Exist(ruta_img_foto) Then Kill ruta_img_foto > > or > > 2) Try Kill ruta_img_foto > > of course, maybe depends of how the if-else works respect the try logic! > > please, i need this info, i use low end machines like daruma's !!!! > (512Mb ram, and 800MHz cpu) >
If you can be 100 % sure that Kill ruta_img_foto won't fail because of access rights, I would prefer this. If not, you will have to use Try Kill and this will be the same as example 2, so you'd be better off with that one from scratch. But can't you avoid calling this again and again, just calling it once at the beginning, find out if it's there and then kill it or test its access right etc.? My experience with Linux is that file access is extremely efficient and fast, even on slower machines. (But it depends heavily on buffers, i. e. RAM.) Or is ruta_img_foto only one out of a large number of files? Or does it appear again and again? Then maybe it's wiser to kill it just when you leave the function which created it. So you could be sure it's not there, that would save you looking for it at all. (Sometimes some smart organizing is easier on slow machines than trying to find the fastest method to clean up - I have been programming since ZX 81 and 4 MHz PC...) Rolf ------------------------------------------------------------------------------ November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user