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

« back to all changes in this revision

Viewing changes to fpcdocs/objectex/ex14.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 ex14;
 
2
 
 
3
{ Program to demonstrate the TStream.Close method }
 
4
 
 
5
Uses Objects;
 
6
 
 
7
Var L : String;
 
8
    P : PString;
 
9
    S : PDosStream; { Only one with Close implemented. }
 
10
 
 
11
begin
 
12
  L:='Some constant string';
 
13
  S:=New(PDosStream,Init('test.dat',stcreate));
 
14
  Writeln ('Writing "',L,'" to stream with handle ',S^.Handle);
 
15
  S^.WriteStr(@L);
 
16
  S^.Close;
 
17
  Writeln ('Closed stream. File handle is ',S^.Handle);
 
18
  S^.Open (stOpenRead);
 
19
  P:=S^.ReadStr;
 
20
  L:=P^;
 
21
  DisposeStr(P);
 
22
  Writeln ('Read "',L,'" from stream with handle ',S^.Handle);
 
23
  S^.Close;
 
24
  Dispose (S,Done);
 
25
end.
 
 
b'\\ No newline at end of file'