[Gambas-user] Write-Read from text file

Jacky jscops at ...11...
Tue Jun 27 09:32:31 CEST 2006


Le Mardi 27 Juin 2006 08:43, Eilert a écrit :
> Jose J. Rodriguez schrieb:
> > On 6/26/06, LinuxSeeker <linuxseeker at ...626...> wrote:
> >> I am writing a program that needs to interact with the user and save the
> >> user's preferences (name, number of textboxes etc) in a text file (named
> >> "conf") at the same directory where the executable is located.
> >
> > [snip]
> >
> >>  Any suggestions on how to make this work? How can I update the
> >> configuration file without re-writing the entire configuration file? How
> >> do I select which line to read from?
> >
> > You should consider using the Gambas component gb.settings
> > (Application settings management):
> > http://www.gambasdoc.org/help/comp/gb.settings
> >
> > Regards,
> > Joe1962
>
> Hi Jose,
>
> Thanks for this tip - never knew about this thing. But it's heavily
> undocumented, I doubt he'll get it to work as even I have some problems
> understanding how it would work.
>
> If you know how to handle it, shouldn't we develop some easy examples?
>
> Just like>
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

>
> - initiating a new ini-file
> - reading from the ini-file
> - writing values into it
> - replacing values
>
> Regards
>
> Rolf

Salut,

With settings component Gambas create automaticaly a new file whose name is 
your program name with the .conf extension locate in /home/user/.gambas for 
gambas1
to update it see example below.
Type = "mysql"
Name = "test"
Login = "user"
Password = "123456"
Version = "1.00"
Settings["/dbase/Type"] = Type
Settings["/dbase/Name"] = Name
Settings["/dbase/Login"] = login.
Settings["/dbase/Password"] = Password
Settings["/Version"] = Version

to read it
Type = Settings["/dbase/Type"]
Name = Settings["/dbase/Name"] 
Login = Settings["/dbase/Login"]
Password = Settings["/dbase/Password"]
Version = Settings["/Version"]

Jack




More information about the User mailing list