Sample code for 30+ languages & platforms
Lazarus Pascal

Example: Http.GetCacheRoot method

Demonstrates the GetCacheRoot method.

Chilkat Lazarus Pascal Downloads

Lazarus Pascal
program ChilkatDemo;

// Demonstrates using the Chilkat Pascal wrapper via the C bridge DLL.
// Builds as a console application under Lazarus (FPC) or Delphi.

{$IFDEF FPC}
  {$MODE DELPHI}
{$ENDIF}
{$APPTYPE CONSOLE}

uses
  {$IFDEF UNIX}
  cthreads,
  {$ENDIF}
  SysUtils,
  CkDllLoader,
  Chilkat.Http;

// ---------------------------------------------------------------------------

procedure RunDemo;
var
  http: THttp;

begin
  http := THttp.Create;

  //  Establish 2 cache root directories.
  http.AddCacheRoot('c:/example/httpCacheA/');
  http.AddCacheRoot('c:/example/httpCacheB/');

  WriteLn('Number of cache roots: ' + http.NumCacheRoots);

  WriteLn('1st cache root: ' + http.GetCacheRoot(0));
  WriteLn('2nd cache root: ' + http.GetCacheRoot(1));

  //  Output:

  //  Number of cache roots: 2
  //  1st cache root: c:/example/httpCacheA/
  //  2nd cache root: c:/example/httpCacheB/


  http.Free;

end;

// ---------------------------------------------------------------------------

begin

  try
    RunDemo;
  except
    on E: Exception do
      WriteLn('Unhandled exception: ', E.ClassName, ': ', E.Message);
  end;

  WriteLn;
  {$IFDEF MSWINDOWS}
  WriteLn('Press Enter to exit...');
  ReadLn;
  {$ENDIF}
end.