Hello everyone,
i simply dont know why fopen doesnt work proper on vista.
Outside my working folders fopen fails, when i want
to create a file.
of course it may depend on read/write access, and i played
around with it. But nothing helps so far.
Help needed, thx
Michael
fopen & Vista64(32)
Moderators: hgm, Rebel, chrisw
Re: fopen & Vista64(32)
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.
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.
-
- Posts: 319
- Joined: Fri Dec 18, 2009 11:40 am
- Location: Naperville, IL
Re: fopen & Vista64(32)
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.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.
This is a fair suggestion though.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.
-
- Posts: 879
- Joined: Mon Dec 15, 2008 11:45 am
Re: fopen & Vista64(32)
First, thx for reply.
www.msdn.microsoft.com/en-us/library/ee419001
Looks like i will find the solution here.
ohhh my god
michael
www.msdn.microsoft.com/en-us/library/ee419001
Looks like i will find the solution here.
ohhh my god
michael
-
- Posts: 879
- Joined: Mon Dec 15, 2008 11:45 am
Re: fopen & Vista64(32)
ps: of course i browsed the web on this more general problem forUncombedCoconut wrote:This is a fair suggestion though.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.
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. )
michael
-
- Posts: 6073
- Joined: Sat Apr 01, 2006 9:34 pm
- Location: Scotland
Re: fopen & Vista64(32)
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.Desperado wrote:First, thx for reply.
www.msdn.microsoft.com/en-us/library/ee419001
Looks like i will find the solution here.
ohhh my god
michael
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.
Hope this helps a little.
Christopher