Sign in to follow this  
Followers 0
ame1011

Replacement for ini files

6 posts in this topic

Hey there, currently I am storing Question/Answer pairs in '.ini' files and for the most part this is working out for me. However, problems arise when the questions or answers have line breaks or '=' characters in them. I was wondering if there is any better method of storing these values without the need to install external apps (such as databases).

Should there be no alternative, I plan to just replace all illegal characters with a legal one (e.g. '=' would become '|') but I thought I'd just pose this question first.


[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]

Share this post


Link to post
Share on other sites



im not sure but maybe you have to slash it like \= or something. if not just change it to some other character and if you need to in your script add something that will find |'s and make them = signs

Share this post


Link to post
Share on other sites

yup, like I said that's what I plan to do. Just wondering if theres something out there that will allow me to keep my questions intact.


[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

here's my take:

to store the Q&A properly, all you'd need is to convert the CR and LF into something else, then make a file with alternating pairs of questions, answers, example:

Lightest atom?

Hydrogen

Which moderator tolerates idiocy the least?

Valik

see? then you load it into an array with _FileToArray(), or whatever it is, and access the question's by accessing the odd's (count is kept in 0, so first is at 1) and the answer is the next in the array

simple enough?

StringReplace($line,@CR,"|CR|") works well for me.

Edited by Zacharot

Share this post


Link to post
Share on other sites

yup, like I said that's what I plan to do. Just wondering if theres something out there that will allow me to keep my questions intact.

Check out the SQLite functions in the current version of AutoIt. Make this the project you need to learn how to use an SQL database.

:rolleyes:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

XML All the way.

XML UDF

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0