VS打开时无法从共享目录打开ini文件 [英] can't open ini file from shared directory when VS is open

查看:125
本文介绍了VS打开时无法从共享目录打开ini文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

打开Visual Studio时,从网站读取.ini文件时遇到问题.

我正在尝试使用GetPrivateProfileInt打开文件,而.ini文件位于同一台计算机上,但通过共享目录(例如\\ SHARED_DIR \ requestedIniFile.ini)查找.请求成功.但是如果我在打电话时有Visual Studio的开放版本(我正在使用VS 2005 pro,SP1),则请求失败.

如果我将路径更改为共享位置的确切路径:C:\ SHARED_DIR \ requestedIniFile.ini-调用成功.

我们在4台不同的计算机上遇到了此问题,这些计算机具有不同的.ini文件,并且在VS上打开了不同的项目.

似乎VS阻止了共享目录端口(或者可能是VS源控件).但我不能说真的.

您能想到一个原因吗?有没有人遇到这个问题?

谢谢,
科比.

[edit]删除了虚假代码块-OriginalGriff [/edit]

I have a problem reading an .ini file from a web location, when the visual studio is open.

I am trying to open the file using GetPrivateProfileInt, while the .ini file is on the same computer, but is loooked up via a shared directory, like: \\SHARED_DIR\requestedIniFile.ini. the request succeeds. but if I have an open version of Visual Studio (I am using VS 2005 pro, SP1) when Im making the call - the request fails.

If I change the path to be the exact path of the shared location: C:\SHARED_DIR\requestedIniFile.ini - the call succeeds.

We have encountered this problem in 4 different computers, with different .ini files, with different projects open on the VS.

it seems like the VS is blocking the shared dir port, (or maybe the VS source control). but I can''t really tell.

Can you think of a reason for it? has anyone encountered this problem?

Thanks,
Koby.

[edit]Spurious Code Block removed - OriginalGriff[/edit]

推荐答案

您说如果我将路径更改为共享位置的确切路径,则C: \ SHARED_DIR \ requestedIniFile.ini然后成功."那应该给您一个线索,它是文件夹相关的问题.为什么不一直使用完整路径?不是更安全吗?
You say "If I change the path to be the exact path of the shared location: C:\SHARED_DIR\requestedIniFile.ini then it succeeds." That should give you a clue that it''s a folder-relative problem. Why not just use the full path all the time? Wouldn''t that be safer?


,如果您的意思是当您单独运行代码(如在可执行文件中)而不是从Visual Studio运行代码时它可以工作,那么问题就出在这里了.工作目录可能不同的事实.当您从Studio运行时,工作目录是项目位置(可能是您的目标目录,无法准确调用),而不是可执行文件的位置.您可以根据需要更改此设置(无法回忆起该怎么做,但它隐藏在选项中的某个位置).
if you mean that it works when you run the code on its own (as in executable) but not from visual studio, then the problem''s probably the fact that the working directory''s different. when you run from studio, the working directory is the project location (may be your target directory, can''t recall exactly), not the location of the executable. you can change this setting if you''d like (can''t recall off the top of my head how to do it, but it buried somewhere in the options).


这篇关于VS打开时无法从共享目录打开ini文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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