You might try using fopen_s() instead: it supposedly provides better security (?) but more importantly, it also returns an error code that should show the difference between a missing file versus a file you don't have read/write permissions to. If that fails, you might also consider using the Win32 CreateFile() API call, which would at least remove any interference caused by the RTL.
I would also respectfully suggest that you move this type of question to a more appropriate forum, such as www.codeproject.com or www.codeguru.com.
humble_programmer wrote:You might try using fopen_s() instead: it supposedly provides better security (?) but more importantly, it also returns an error code that should show the difference between a missing file versus a file you don't have read/write permissions to. If that fails, you might also consider using the Win32 CreateFile() API call, which would at least remove any interference caused by the RTL.
I'd disagree with this, unless the program is intended to be Windows-only forever. fopen_s() is non-standard and provides dubious benefits; after an ordinary fopen(), you can already get the error code by checking errno.
I would also respectfully suggest that you move this type of question to a more appropriate forum, such as www.codeproject.com or www.codeguru.com.
I would also respectfully suggest that you move this type of question to a more appropriate forum, such as www.codeproject.com or www.codeguru.com.
This is a fair suggestion though.
ps: of course i browsed the web on this more general problem for
hints first.
but my second thought was, that nearly each free chess-engine source i looked at,
was using somewhere fopen for creating debug,statistic outputs.
So someone should know what is going on with vista ? (so i thought it is a good place to ask for it. )
Most fopen() issues are related to permissions on Vista and Windows 7. The user that creates the file needs permission to create it in the directory where you create it.
To me if you gave you (ie who you are logged on as and it does not matter if Administrator has it) full control of the directory, you should cure the problem. Failing that create the file where you know Everyone has full control.
I have seen this problem before with IIS and PHP on Vista and Windows 7 x64 where it becomes very tricky as you should not give chmod 777 to anywhere.