fopen在程序文件文件夹中返回无效的句柄
你好
我有一个奇怪的问题.我的应用程序使用fopen(..,"a +")写入日志文件.
i have a strange problem. My application uses fopen(..,"a+") to write to logfiles.
将此应用程序安装到Windows程序文件文件夹中时,不会将任何内容写入日志文件.
When installing this application into windows program files folder, nothing is written to logfile.
在其他位置(例如c:\)安装时,将记录所有内容.
When installing elsewhere, for instance c:\, all is logged.
我不确定从哪里开始调查.它与系统,访问权限有关吗?
I am not sure where to start investigate. Is it related to system, access rights, something like this.
或者它与设置例程有关.我使用VS2008安装项目,但未找到与访问权限相关的开关.
Or is it related to setup routine. I use a VS2008 setup project but found no switch related to access rights.
还是与我的申请有关?链接器,编译器标志-
Or related to my application ? linker, compiler flags-
这会在XP计算机,Vista,Windows 2003上发生.
This happens on XP machines, vista, windows 2003.
任何帮助表示赞赏.
问题可能是因为 Program 和 文件.
The problem could be because there is a space between Program and Files.
您可以尝试将路径用双引号引起来.
You could try enclosing the path within double quotes.
fopen("\"C:\\Program Files\\logfile\"", "a+");