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

« back to all changes in this revision

Viewing changes to docs/objectex/ex18.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 ex18;
2
 
 
3
 
{ Program to demonstrate the TStream.Read method }
4
 
 
5
 
Uses Objects;
6
 
 
7
 
Var Buf1,Buf2 : Array[1..1000] of Byte;
8
 
    I : longint;
9
 
    S : PMemorySTream;
10
 
 
11
 
begin
12
 
  For I:=1 to 1000 do
13
 
    Buf1[I]:=Random(1000);
14
 
  Buf2:=Buf1;
15
 
  S:=New(PMemoryStream,Init(100,10));
16
 
  S^.Write(Buf1,SizeOf(Buf1));
17
 
  S^.Seek(0);
18
 
  For I:=1 to 1000 do
19
 
    Buf1[I]:=0;
20
 
  S^.Read(Buf1,SizeOf(Buf1));
21
 
  For I:=1 to 1000 do
22
 
    If Buf1[I]<>buf2[i] then
23
 
      Writeln ('Buffer differs at position ',I);
24
 
  Dispose(S,Done);
25
 
end.
 
 
b'\\ No newline at end of file'