User Tools

Site Tools


19.1.3 Profiles

If, for example, you want to back up a certain directory to different data carriers or different directories to a USB hard disk, it is advisable to use different profiles. For each of these cases, a special backup profile is necessary, which you can save in a configuration file. E-mail or FTP programmes also frequently use different accounts or profiles. It is often necessary to create or change new profiles or to delete unused profiles.

One solution could be

  • assign individual sections in the configuration file to the profiles and only read out the key-value pairs stored under a selected profile, evaluate them and make them available to the programme as a (start) profile. This approach requires Gambas3 with extended properties and methods for the class gb.settings or a special solution for Gambas 2.
  • to create a separate configuration file for each required profile at runtime of the programme in order to save changed profile data or to delete the configuration file for an existing profile. This path is not followed here.

Do not try to edit a configuration file with a Settings object and with a serial stream (Open, …) at the same time. Yes, it is possible because Linux allows several processes to open a file at the same time, but it jeopardises the integrity of your data. This is because you can never know the order in which the read/write accesses are executed, because all these accesses are buffered.

' Man sollte nicht in Dateien stöbern und Inhalte ändern, die bereits von einem Objekt genutzt werden.
  hFile = OPEN (Application.Path &/ "Profil/ftp.conf") FOR INPUT ' Profilnamen auslesen
  WHILE NOT Eof(hFile)
    LINE INPUT #hFile, sLine
    IF Mid(sLine, 1, 3) = "[P_" THEN
       aProfilMatrix.Add(Mid(sLine, 2, String.Len(sLine) - 2))
       cmbFTPProfilName.Add(Mid(sLine, 4, String.Len(sLine) - 4))
  CLOSE #hFile

19.1.3 Download

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k19/k19.1/k19.1.3/start.txt · Last modified: 13.10.2023 by emma

Page Tools