Sign in to follow this  
Followers 0
Tomb

why doesnt this simple iniweite and iniread work?

5 posts in this topic

$ck = "cks.ini"

$x = "12"

IniDelete($ck, "section1")
IniWriteSection($ck, "section1", $x)

$om = IniReadSection($ck, "section1")

MsgBox(0, "hi", $om)

i am trying to become more familiar with iniwrite and iniread. i tried to make myself an example code. it writes just fine, but it fails to read, it always reads as 1 in my msgbox. what am i doing wrong?

Share this post


Link to post
Share on other sites



From Helpfile, IniReadSection:

"Return Value

Success: Returns a 2 dimensional array where element[n][0] is the key and element[n][1] is the value"

Share this post


Link to post
Share on other sites

$ck = "cks.ini"

$x = "12"

IniDelete($ck, "section1")
IniWriteSection($ck, "section1", $x)

$om = IniReadSection($ck, "section1")

MsgBox(0, "hi", $om)

i am trying to become more familiar with iniwrite and iniread. i tried to make myself an example code. it writes just fine, but it fails to read, it always reads as 1 in my msgbox. what am i doing wrong?

uh so how do i use that?

that is confuse of me

Share this post


Link to post
Share on other sites

You're not using IniWriteSection and IniReadSection correctly. They're not very practical if you only want to read/write 1 variable anyway.

Use this instead:

$ck = "cks.ini"

$x = "12"

;IniDelete($ck, "section1") <- not needed because you can rewrite a value without deleting it
IniWrite($ck, "section1", "key1", $x);<- you forgot to state the key

$om = IniRead($ck, "section1", "key1", 0)

MsgBox(0, "hi", $om)

Share this post


Link to post
Share on other sites

that worked perfectly

thank you

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