2000.11.07 19:59 "Win32 not properly closing files", by Peter Montgomery

2000.11.07 19:59 "Win32 not properly closing files", by Peter Montgomery

I am currently using TIFFLib on a project under Windows 95/98/NT/2000. I have been using the library for quite some time now but I have recently run into a problem. The Win32 specific parts of TiffLib don't seem to properly close open files. Here's a snippet of code...

 Tif = TIFFOpen(FileInfo->FullFileName, "r");

 if (Tif){
  TIFFClose(Tif);
  Tif = NULL;
 }

As you can see, this code simply opens a TIFF and then immediately closes it. The problem is that while the program is still running, Windows won't let me move or re-name the file I opened/closed. As soon as I close the program then everything works fine again. This fails under both Win95 and WinNT. I haven't tested it under 98 yet but I doubt it will be different. I have worked through the code but have found nothing suspect. Does anyone have any experience like this? I only noticed it when I tried to move a file that I have closed and Windows balked. Normally my code simply opens files for reading and then writes new files under a different name, thus I never noticed the problem until now.

Thanks,
PeterM