home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / install / inifile / inidemo.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-05-02  |  1.7 KB  |  67 lines

  1. Program IniDemo;
  2. Uses pd_Ini;
  3.  
  4. Var PMyIni : PConfigFile;
  5.  
  6. Begin
  7.  
  8.   PMyIni := New( PConfigFile,
  9.                    Init( 'c:\projekte\MyIni.INI', 'My first real Application V0.99', 'MyIni' ));
  10.  
  11.   WriteLn( 'Trying to set group YourGames :',PMyIni^.SetGroup( 'YourGames' ));
  12.  
  13.   WriteLn( 'Tetris has the value "',PMyIni^.GetItem( 'Tetris' ),'"' );
  14.   If PMyIni^.GetItem( 'Tetris' ) <> ''
  15.     then
  16.       Begin
  17.  
  18.         WriteLn( 'Erasing Tetris...' );
  19.         PMyIni^.SetItem( 'Tetris', '' )
  20.       End
  21.     else
  22.       Begin
  23.  
  24.         WriteLn( 'Setting Tetris to "HiScore=(11000)< Max >"' );
  25.         PMyIni^.SetItem( 'Tetris', 'HiScore=(11000)< Max >' );
  26.       End;
  27.  
  28.   WriteLn( 'MyVal has the value "',PMyIni^.GetItem( 'MyVal' ),'"');
  29.   WriteLn( 'Test has the value "',PMyIni^.GetItem( 'Test' ),'"');
  30.  
  31.   If not PMyIni^.SetGroup( 'FirstApp' )
  32.     then
  33.       Begin
  34.  
  35.         WriteLn( 'Creating group "FirstApp"' );
  36.         PMyIni^.CreateGroup( 'FirstApp' )
  37.       End
  38.     else
  39.       Begin
  40.  
  41.         WriteLn( 'Erasing group "FirstApp"' );
  42.         PMyIni^.EraseGroup( 'FirstApp' );
  43.       End;
  44.  
  45.   WriteLn( 'Trying to set group "YourGames" :',PMyIni^.SetGroup( 'YourGames' ));
  46.  
  47.   WriteLn( '"Test" has the value "',PMyIni^.GetItem( 'Test' ),'"');
  48.  
  49.   WriteLn( 'Setting group "MyIni"' );
  50.   If not PMyIni^.SetGroup( 'MyIni' )
  51.     then
  52.       Begin
  53.  
  54.         WriteLn( 'Creating group "MyIni"' );
  55.         PMyIni^.CreateGroup( 'MyIni' );
  56.       End;
  57.  
  58.   WriteLn( 'SetItem( ''HelloMsg'',''Hello, World !'');' );
  59.   PMyIni^.SetItem( 'HelloMsg','Hello, World !' );
  60.  
  61.   WriteLn( 'Erasing group "TestGroup"' );
  62.   PMyIni^.EraseGroup( 'TestGroup' );
  63.  
  64.   PMyIni^.Done( False );
  65.  
  66. End.
  67.