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

« back to all changes in this revision

Viewing changes to fpcdocs/olinuxex/ex21.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 Example21;
 
2
 
 
3
{ Program to demonstrate the Link and UnLink functions. }
 
4
 
 
5
Uses oldlinux;
 
6
 
 
7
Var F : Text;
 
8
    S : String;
 
9
begin
 
10
  Assign (F,'test.txt');
 
11
  Rewrite (F);
 
12
  Writeln (F,'This is written to test.txt');
 
13
  Close(f);
 
14
  { new.txt and test.txt are now the same file }
 
15
  if not Link ('test.txt','new.txt') then
 
16
    writeln ('Error when linking !');
 
17
  { Removing test.txt still leaves new.txt }
 
18
  If not Unlink ('test.txt') then
 
19
    Writeln ('Error when unlinking !');
 
20
  Assign (f,'new.txt');
 
21
  Reset (F);
 
22
  While not EOF(f) do
 
23
    begin
 
24
    Readln(F,S);
 
25
    Writeln ('> ',s);
 
26
    end;
 
27
 Close (f);
 
28
 { Remove new.txt also }
 
29
 If not Unlink ('new.txt') then
 
30
   Writeln ('Error when unlinking !');
 
31
end.