~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to docs/objectex/ex17.pp

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Program ex17;
2
 
 
3
 
{ Program to demonstrate the TStream.Seek method }
4
 
 
5
 
Uses Objects;
6
 
 
7
 
Var L : String;
8
 
    Marker : Word;
9
 
    P : PString;
10
 
    S : PDosStream;
11
 
 
12
 
begin
13
 
  L:='Some constant string';
14
 
  { Buffer size of 100 }
15
 
  S:=New(PDosStream,Init('test.dat',stcreate));
16
 
  Writeln ('Writing "',L,'" to stream.');
17
 
  S^.WriteStr(@L);
18
 
  Marker:=S^.GetPos;
19
 
  Writeln ('Set marker at ',Marker);
20
 
  L:='Some other constant String';
21
 
  Writeln ('Writing "',L,'" to stream.');
22
 
  S^.WriteStr(@L);
23
 
  S^.Close;
24
 
  S^.Open (stOpenRead);
25
 
  Writeln ('Size of stream is : ',S^.GetSize);
26
 
  Writeln ('Seeking to marker');
27
 
  S^.Seek(Marker);
28
 
  P:=S^.ReadStr;
29
 
  L:=P^;
30
 
  DisposeStr(P);
31
 
  Writeln ('Read "',L,'" from stream.');
32
 
  S^.Close;
33
 
  Dispose (S,Done);
34
 
end.
 
 
b'\\ No newline at end of file'