用ASP读取Windows标准INI格式文件

2016-01-29 18:18 16 1 收藏

用ASP读取Windows标准INI格式文件,用ASP读取Windows标准INI格式文件

【 tulaoshi.com - ASP 】

  Have you needed to get information dynamically from Standard Formatted Windows INI files? Here's a set of tools to help you with just that. In this tutorial, we are going to discuss specific actions. More details can be obtained by looking at the files supplied.

Let's see how to implement the tools usage by looking at some parts of TEST.ASP:


<!--#include virtual="/readini/inifile.inc"--
For fairly obvious reasons, we need to include the tools in our page, of course we should fix the path the include file is stored it.

<%
     call IniFileLoad("physical=c:boot.ini")
%

Next, a call to IniFileLoad fetches the INI file into a dictionary object called IniFileDictionary. You can specify a physical path as listed above, or you could specify a virtual path such as "virtual=/readini/test.ini".


StrBuf = IniFileValue("boot loader|timeout")
StrBuf = IniFileValue("boot loader")

Finally, we need to ask for a value from the dictionary. You can specify an individual value by using the section name and value name separated by a vertical bar (sometimes referred to as a 'pipe') character. Alternately, we can request the entire content of a section by not specifying the value name. When the section is returned, the data is formatted as:

   Section name|Value name=Value Data~Section name|ValueName=Value Data

Note that each section/value/data triplet is separated by a tilde character.

Well, that's all there is to it! Happy programming!

Attachments:
This ZIP file contains an INC file with the utility routines, a test INI file, and an ASP file that demonstrates the tools usage.

http://www.4guysfromrolla.com/webtech/code/inifile.zip

 

来源:https://www.tulaoshi.com/n/20160129/1505223.html

延伸阅读
标签: 电脑入门
随着OS X Yosemite正式版发布,苹果的iCloud Drive网盘也正式开通了。通过它不仅可以用来在OS X和iOS之间同步文件数据,还首次让Mac用户上传任意格式的文件并进行管理。这和Dropbox、 Google Drive等网盘并无二致,唯一的限制是单个文件大小不能超过15GB。 用户可以通过OS X Yosemite里面的Finder直接访问iCloud Drive,或者通过Safari6...
如何操作INI文件?   INI 文件在系统配置及应用程序参数保存与设置方面,具有很重要的作用,所以可视化的编程一族,如 VB、VC、VFP、Delphi 等都提供了读写 INI 文件的方法,其中Delphi中操作 INI 文件,最为简洁,这是因为Delphi3提供了一个 TInifile 类,使我们可以非常灵活的处理 INI 文件。 一、有必要了解 INI 文件的...
当我每次调用CString strExts;  ::GetPrivateProfileString("custom","username","",   strExts.GetBuffer(MAX_PATH),MAX_PATH,".\Config.ini");  m_username = strExts; 的时候; 发现m_username长度都是0; 原来要在调用getbuffer函数以后再调用 strExts.ReleaseBuffer();  也就是说当调用CString::GetBuffer()后...
标签: autocad教程
关键字: AutoCAD 2009 Photoshop手绘 AutoCAD对象 中望CAD AutoCAD三维造型本文主要介绍如何运用中望CAD来生成其他的文件格式。 DWF格式的文件能够在保证图纸安全的前提下,与别人进行设计交流,在ACAD中可以通过其打印里面的DWF6 eplot.pc3来实现DWF的输出,在中望CAD中并不附带此pc3文件,不能通过打印来实现DWF的输出,但是中望C...
标签: 电脑入门
raw是什么格式文件? RAW格式是数码相机的专用格式,是真正意义上的电子底片。RAW格式也是体现数码影像极致质量的唯一的格式。 RAW的原意就是未经加工。可以理解为:RAW图像就是CMOS或者CCD图像感应器将捕捉到的光源信号转化为数字信号的原始数据。RAW 文件是一种记录了数码相机传感器的原始信息,同时记录了由相机拍摄所产生的一些原数据(...

经验教程

918

收藏

9
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部