寻找一些C ++库(比如boost :: program_options),它能够返回INI文件的行号,在这里find给定的选项或部分。 用例: 我要求图书馆在“[SSS]”部分find价值“vvv”。 库返回find“[SSS]”部分中的“vvv”的行号,或-1。 它使我有能力说“第55行:vvv必须<256”。 我迭代INI文件的部分和validation他们的名字。 当发现一些狂野的部分时,我会说:“第55行:[哈哈哈]部分是未知的”。 更新:我知道“INI比猛犸象年长”,但目前我必须将大型windows项目移植到跨平台,不能很快摆脱.ini文件。
我有一个ini文件,其中包含一些示例值,如: [Section1] Value1 = 10 Value2 = a_text_string 我试图加载这些值,并用Boost在我的应用程序中打印它们,但我不明白如何在C ++中执行此操作。 我在这个论坛search,以find一些例子(我总是使用C,所以我不是很好的C + +),但我只发现如何从文件一次读取值的例子。 我需要加载一个单一的值,如string = Section1.Value2因为我不需要读取所有的值,但只是less数。 我想加载单个值并将其存储在variables中,以便在我的应用程序中使用它们。 Boost可以做到这一点吗? 目前,我正在使用这个代码: #include <iostream> #include <string> #include <set> #include <sstream> #include <exception> #include <fstream> #include <boost/config.hpp> #include <boost/program_options/detail/config_file.hpp> #include <boost/program_options/parsers.hpp> namespace pod = boost::program_options::detail; int main() { std::ifstream s("file.ini"); if(!s) { std::cerr<<"error"<<std::endl; return 1; } std::set<std::string> options; options.insert("Test.a"); […]
我需要用Python3读,写和创build一个INI文件。 FILE.INI default_path = "/path/name/" default_file = "file.txt" Python文件: # read file and if not exists ini = iniFile( 'FILE.INI' ) # Get and Print Config Line "default_path" getLine = ini.default_path # Print (string)/path/name print getLine # Append new line and if exists edit this line ini.append( 'default_path' , 'var/shared/' ) ini.append( 'default_message' , 'Hey! […]
是否有可能使用PHP上传〜100 MB的文件? 如果是这样,configuration文件( php.ini )中需要做什么修改? 斯里兰卡
我正在尝试使用以下格式读取.ini文件: [SectionName] total=4 [AnotherSectionName] total=7 [OtherSectionName] total=12 基本上我想打印出.ini文件中的某些值,例如OtherSectionName下的总数,然后是OtherSectionName的总数。
我正在为Java中的遗留应用程序编写一个embedded式替代品。 其中一个要求是旧应用程序所使用的ini文件必须原样读入新的Java应用程序。 这个ini文件的格式是普通的窗口样式,带有标题部分和键=值对,使用#作为注释的字符。 我尝试使用从Java的属性类,但当然不会工作,如果名称冲突不同的标题之间。 所以问题是,在这个INI文件中读取和访问密钥最简单的方法是什么?
我使用下面的PHP函数: file_get_contents('http://example.com'); 每当我在某台服务器上执行此操作时,结果都是空的。 当我在其他地方做的时候,结果就是页面的内容可能是什么。 但是,当我在结果为空的服务器上使用本地函数时 – 无需访问外部URL( file_get_contents('../simple/internal/path.html'); ),它确实有效。 现在,我很确定它有一些特定的php.iniconfiguration。 我不知道的是, 哪一个。 请帮忙。
.NET框架中是否有可以读写标准.ini文件的类: [Section] <keyname>=<value> … delphi有TIniFile组件,我想知道是否有什么类似的C#?