ini

c++ boost library - writing to ini file without overwriting?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 04:00:05
问题 im trying to write an ini file using boost library's ini parser and property tree. The file is written in stages - i mean every function writes a portion of it. At the end im left with only the last output instead of having everything written down. Sample code i use while writing: property_tree::ptree pt; string juncs=roadID; size_t pos = juncs.find_last_of("j"); string jstart = juncs.substr(0,pos); string jend = juncs.substr(pos,juncs.length()); pt.add(repID + ".startJunction", jstart); pt

How to read multiline values in inifile

北城以北 提交于 2019-12-08 00:57:19
问题 I am trying to use a multi line value as specified as list in ini file, I was able to read sections but not able read to multi line values from a given key. I have tried to using list manner it completely failed. # Ini file [UNITS] COMPARE_UNITS = [list [11871000 118700] [1198100 1198100] ] [VARS] OLD_REL = 4.3 NEW_REL = 4.5 I have tried to using string based format also i failed but i could able to read sections and first line of a given key value. # Ini file [UNITS] COMPARE_UNITS = "

Regex to match ini value

这一生的挚爱 提交于 2019-12-07 16:48:47
问题 I'm trying to match the last name of a value of an ini line. foo.bar.far.boo = "some value" I can match 'boo =' but I just need 'boo' I do (\w+)\s*= but it matches the equal signs, but I don't want it to be matched. By the way, I should be able to get if there is no sub values like : foo = "value" 回答1: Use \w+(?=\s*=) (?=...) is a positive lookahead assertion, meaning "assert that the enclosed regex can be matched here, but don't make it part of the match itself". So the regex matches one or

Read ini file which does not have any section?

你说的曾经没有我的故事 提交于 2019-12-07 14:33:46
问题 My ini file does not have any section. It has following data com.ibm.rcp.toolbox.admin/toolboxvisibleChild=false com.ibm.collaboration.realtime.community/defaultAuthType=ST-DOMINO-SSO com.ibm.collaboration.realtime.brokerbridge/startBroker=false com.ibm.collaboration.realtime.webapi/startWebContainer=true I want to use function. [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key,string def, StringBuilder retVal, int size,string filePath); My

How to put configuration information inside the executable?

狂风中的少年 提交于 2019-12-07 14:01:16
问题 If we want to store critical information, like passwords and server addresses, inside the executable file generated by the Delphi compiler, how can we do that, without knowing the final executable size and binary structure, like at the end of the file for example? Side note: The text to be stored is already encrypted; and in some computers the windows don't give access to write in the registry, specially when the user is not administrator, and there are hacks to monitor registry changes and

Delphi inifiles ReadDateTime

a 夏天 提交于 2019-12-07 11:31:57
问题 The essence in the following: procedure TForm1.Button1Click(Sender: TObject); var cfile: TInifile; Date1: TDateTime; begin Date1 := IncYear(Now, -50); cfile := TInifile.Create(ExtractFilePath(Application.ExeName) + 'Settings.ini'); try cfile.WriteDateTime('Main', 'DateTime', Date1); ShowMessage('Recorded in the ini file ' + DateTimeToStr(Date1)); Date1 := cfile.ReadDateTime('Main', 'DateTime', Now); ShowMessage('Read from ini file ' + DateTimeToStr(Date1)); finally cfile.Free; end; end; Entry

Is “login.ini” a reserved name?

风流意气都作罢 提交于 2019-12-07 10:53:50
问题 I store the MRU of logins to my application in a file called login.ini and I save it in widnows application folders. I noticed that on some systems — I don't know why; I cannot find a common cause — the user cannot create the file, whereas it creates all other files in the same folder. The only reason I can think of is that some antivirus/windows setting/... doesn't allow this particular user to create the file on this system. I solved the problem by renaming the file and it seems ok, but I'd

Batch file to edit line in ini file

筅森魡賤 提交于 2019-12-07 10:17:00
问题 I have an ini file that gets autogenerated. Its second line is always: Version = W.XX.Y.ZZ Where W is the major version number, XX is the minor version, Y is the Build and ZZ is the Revision. I need to open that ini file and edit that line using a batch file so that the build and revision numbers in that version get removed. Therefore, the line should end up like this: Version = W.XX The major number will always be one character and the minor number will always be two, therefore the entire

Reading path from ini file, backslash escape character disappearing?

a 夏天 提交于 2019-12-07 06:44:57
问题 I'm reading in an absolute pathname from an ini file and storing the pathname as a String value in my program. However, when I do this, the value that gets stored somehow seems to be losing the backslash so that the path just comes out one big jumbled mess? For example, the ini file would have key, value of: key=C:\folder\folder2\filename.extension and the value that gets stored is coming out as C:folderfolder2filename.extension . Would anyone know how to escape the keys before it gets read

PowerShell to Read single value from simple .ini file

谁说胖子不能爱 提交于 2019-12-07 05:21:12
问题 Everything I've found looks way over complex. It's almost like I just need to read a text file. ADAP.ini contains this, nothing else: http://xxx.104.xxx.226 APP=2.3.6 DLL=2.3.6 Using Powershell, how can I read what APP=value is? and or what DLL=value is? I would store the value in a variable and use it later in Powershell script. 回答1: This looks like a good use case for ConvertFrom-StringData which by default looks for key value pairs separated by the equals symbol. Because the first line of