fopen在程序文件文件夹中返回无效的句柄 [英] fopen returns invalid handle in program files folder

查看:74
本文介绍了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+");


这篇关于fopen在程序文件文件夹中返回无效的句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆