Hi,
looks like zip does not close file if it was open using handle from fopen on Windows. Probably it should be fopen/fclose pair, not fopen/CloseHandle.
It is near line 2532 in zip.cpp file.
Regards.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I apologize for the long silence, I had problems accessing the site.
Why did you decide that zip does not close file if it was open using handle from fopen on Windows?
I tried such a simple test:
CWorkbookbook("Incognito");...FILE*f=fopen("Test.xlsx","w");if(f==NULL){std::cout<<"The book saving has been failed"<<std::endl;return0;}book.Save(f,true);std::cout<<"The book has been saved successfully"<<std::endl;while(true);
When the program is in an infinite loop, the file "Test.xlsx" looks closed. I can open it in Excel or delete it.
Tested on Windows 10 Pro 21H1 with MinGW 7.3.0 32-bit for C++.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
in my case it looked like this: I am using software which produced xlsx reports. During one session it might be generated something like 5-10 files. They might be opened in Excel, but cannot be saved because "someone else also opened them". After I close software, this problem disappears. If I'm using "book.Save( f, false )" and closing reports separately, by fclose, it also do not appear.
I'm tested it with Win10 Pro 21H1, gcc 12.1 MinGW_w64 v10 UCRT 32bit (https://winlibs.com/).
OS-related difference is that I saved reports on network drive.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Sorry for the long silence for various reasons.
Perhaps is the problem related to antivirus software or similar security software?
Just in case, I redesigned the library to call the fclose function directly. Please check if possible.
Hi,
I tried new version, very briefly. It looks like that this problem fixed. Thanks!
I also suggest to add Scratch to CMake. Practically there are no reasons to keep it separately.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
looks like zip does not close file if it was open using handle from fopen on Windows. Probably it should be fopen/fclose pair, not fopen/CloseHandle.
It is near line 2532 in zip.cpp file.
Regards.
Hi,
I apologize for the long silence, I had problems accessing the site.
Why did you decide that zip does not close file if it was open using handle from fopen on Windows?
I tried such a simple test:
When the program is in an infinite loop, the file "Test.xlsx" looks closed. I can open it in Excel or delete it.
Tested on Windows 10 Pro 21H1 with MinGW 7.3.0 32-bit for C++.
Hi,
in my case it looked like this: I am using software which produced xlsx reports. During one session it might be generated something like 5-10 files. They might be opened in Excel, but cannot be saved because "someone else also opened them". After I close software, this problem disappears. If I'm using "book.Save( f, false )" and closing reports separately, by fclose, it also do not appear.
I'm tested it with Win10 Pro 21H1, gcc 12.1 MinGW_w64 v10 UCRT 32bit (https://winlibs.com/).
OS-related difference is that I saved reports on network drive.
Hi,
Sorry for the long silence for various reasons.
Perhaps is the problem related to antivirus software or similar security software?
Just in case, I redesigned the library to call the fclose function directly. Please check if possible.
Hi,
I tried new version, very briefly. It looks like that this problem fixed. Thanks!
I also suggest to add Scratch to CMake. Practically there are no reasons to keep it separately.
Hi,
Done :-) Thanks for your help!