如何将单独的.xml文件包含在vc ++解决方案中 [英] how to include the seperate .xml files in to the vc++ solution

查看:80
本文介绍了如何将单独的.xml文件包含在vc ++解决方案中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我在vs2010中实现了一个vc ++应用程序,我从.xml文件中检索数据以进行库存维护。



1)因此,当我在调试/发布模式下运行我的应用程序时,我可以从.xml文件中检索数据,而当我通过Web浏览器运行我的应用程序时,它无法从中检索数据。 xml文件和应用程序没有响应和敲击。



2)如果我在其他计算机上运行相同的应用程序,它会要求这些.xml文件,所以我添加了这些application.exe所在的文件夹中的.xml文件。然后运行正常。



有什么问题,我做错了我有点困惑。



1)有什么办法,我可以直接将这些.xml文件包含在解决方案中。因此,如果我从网络浏览器或其他计算机执行.exe,它不会产生任何问题。



任何人都可以指导我这个。



提前感谢你。

hello,

I implemented an vc++ application in vs2010, where i am retrieving the data from .xml files for stock maintenance.

1) So when i run my application in Debug/Release mode i can retrieve data from .xml files, where as when i run my application through a web browser it is unable to retrieve data from .xml files and the application is not responding and struck.

2) If i run the same application in other computer it asks for these .xml files, so i added these .xml files in the folder where the application.exe is there. Then it is running fine.

What is the problem and where i am doing wrong i am bit confusion.

1) is there any way, where i can include these .xml files in to the solution directly. So that it wont create any problem if i execute the .exe from web browser or from other computer.

can anyone guide me on this.

Thank u in advance.

推荐答案

好吧,因为你不能保证你的程序将从上面的目录中启动 xmldata 您无法确定路径是否有效。您应该始终使用绝对路径来引用程序的数据文件。在大多数情况下,文件应存储在一个标准位置,您可以通过 SHGetFolderPath 功能 [ ^ ]。
Well since you cannot guarantee that your program will be started from the directory above xmldata you cannot be sure that the path is valid. You should always use absolute paths to refer to your program''s data files. In most cases the files should be stored in one of the standard locations that you can access by the SHGetFolderPath function[^].


这篇关于如何将单独的.xml文件包含在vc ++解决方案中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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