summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/fcl-base/examples/testz2.pp
blob: 1892d26810f3f1b5d5e042b567cae8bde39b14bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Program testz2;

uses zstream;

const
{$ifdef unix}
  eol=#10;
{$else}
  eol=#10#13;
{$endif}

Var F : TGZfileStream;
    S : String;
    i :longint;
    c : char;
begin
  Writeln ('Creating file.');
  S:='This is a sentence'+eol;
  F:=TGZFileStream.create('test.gz',gzopenWrite);
  For I:=1 to 10 do
    F.Write(S[1],Length(S));
  f.Free;
  Writeln ('Done.');
  Writeln ('Reopening file for read.');
  F:=TGZFileStream.Create('test.gz',gzopenread);
  Writeln ('Dumping contents:');
  While F.Read(C,SizeOf(c))<>0 do
    write(c);
  F.free;
  Writeln('Done.');
end.