read from ini file problem!!!

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by cor.

The following code does not read the ini file?

Any suggestions?

var 'nu' seems not get filled

; Read database Tablenames
If OpenPreferences(appdir$+"tables.ini")
PreferenceGroup("Tables")
nrtoread = ReadPreferenceString("t" +"0", "Error")

; read all tables into array
For cnt.b = 1 To nrtoread
nu = "t" + Str(cnt)
NrTables(cnt) = ReadPreferenceString(nu , "Error")
Next cnt

ClosePreferences()
EndIf



tables.ini

[Tables]
t0 = 3 ; nr to read
t1 = tblBTWcode
t2 = tblCatgorie
t3 = tblInkoop

Using Windows 98 SE
Registered PB version : 3.40 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by cor.

Found the problem myself after 1 hour :)

For cnt.b = 1 To nrtoread

must be

For cnt.b = 1 To val(nrtoread)

Using Windows 98 SE
Registered PB version : 3.40 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
Post Reply