Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- SIx Driver RDD v3.00 - Reference Guide - <b>.ini files:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  .INI Files:

  Each database in your application can have an associated .INI file, which
  will provide various information to the Trigger System on how that partic-
  ular database should be opened.  These files can also hold information, in
  user-defined sections, which can be read from the .INI file into an array
  by using Sx_INIheader().

  An .INI file is just a plain ASCII text file that the developer would
  create with their text editor.  The file must have the same base name as
  its associated database file.  For example, TEST.INI would belong to
  TEST.DBF, FOO.INI to FOO.DBF, and so on.

  The format of an .INI files is nearly identical to that of the Windows (tm)
  WIN.INI file.  Comment lines are preceded with a semicolon (;).  Each
  section within the file must begin with a heading.  This header name may
  be in upper, lower, or mixed case.  Each section heading must be on a
  line by itself, surrounded by square brackets, like this:

    [USERINFO]

  On the lines following each header, the information for that section
  should be placed in the following format:

    <LeftValue> = <RightValue>

  For example:

    ; Data to identify a user name and ID

    [USERINFO]                           
    LASTNAME  = Scott                    
    FIRSTNAME = Loren                    
    ID_NUMBER = 12345                    
    TOPSECRET = .T.                      

  This information could then be retrieved by using the Sx_INIheader()
  function as such:

    aInfo := Sx_INIheader( "USERINFO" )

  In this case, the aInfo array would contain the following elements:

    aInfo[1,1] = "LASTNAME" 
    aInfo[1,2] = "Scott"    
    aInfo[2,1] = "FIRSTNAME"
    aInfo[2,2] = "Loren"    
    aInfo[3,1] = "ID_NUMBER"
    aInfo[3,2] = "12345"    
    aInfo[4,1] = "TOPSECRET"
    aInfo[4,2] = ".T."      

  Note that all of the information from the .INI file is read into the
  array elements as character strings.  Any desired conversions to numeric,
  logical, etc. values would need to be handled by the developer.

  The only header name that cannot be used for user-defined section is
  [SXKEYWORDS].  This is reserved for the SIx Driver's use.  By default,
  the SIx Driver does _not_ read in the .INI file when the database is
  opened.  In order to activate this behavior, you must first modify the
  default trigger behavior of Sx_DefTrigger().  This function is contained
  in SIXTRIG.PRG.

  To enable the automatic use of an .INI file, the _sx_INIinit() function
  needs to be called in the EVENT_PREUSE trigger handler.  With this
  enabled, each time a .DBF file is used, a same-named .INI file would be
  automatically opened prior to the database file actually being opened.
  The contents of the reserved [SXKEYWORDS] section would be read in by the
  SIx Driver and used as information regarding how the file should be
  opened.  There are currently four key words that can be used in the
  SXKEYWORDS section:  SHARED, READONLY, ALIAS, and TRIGGER

  For example, the following SXKEYWORDS section would cause the database
  file to be opened in SHARED / READONLY mode, using the ALIAS of "FOOBAR"
  and using a custom trigger function called MyTrigger().

    [SXKEYWORDS]        
    SHARED   = .T.      
    READONLY = .T.      
    ALIAS    = FOOBAR   
    TRIGGER  = MYTRIGGER

  So, using the above settings in my TEST.INI file would allow you to
  open TEST.DBF like this:

    USE test

  Instead of like this:

    USE test SHARED READONLY TRIGGER "MyTrigger"


  Encrypting .INI Files:

  The .INI file can be encrypted from within your application using the
  Sx_Encrypt() function or from DOS with the SIXINI.EXE utility.  Assuming
  the same password code is active, the SIx Driver will automatically decrypt
  it when it reads in the .INI file information.

  NOTE:  See the INIDEMO.PRG sample program for an example of using the
         Data Dictionary (.INI) System.



See Also: The SXINIINFO Array Sx_INIheader() Sx_Encrypt() SIXINI.EXE

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson