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

« back to all changes in this revision

Viewing changes to docs/unixex/ex22.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 Example22;
2
 
 
3
 
{ Program to demonstrate the SymLink and UnLink functions. }
4
 
 
5
 
Uses baseunix,Unix;
6
 
 
7
 
Var F : Text;
8
 
    S : String;
9
 
 
10
 
begin
11
 
  Assign (F,'test.txt');
12
 
  Rewrite (F);
13
 
  Writeln (F,'This is written to test.txt');
14
 
  Close(f);
15
 
  { new.txt and test.txt are now the same file }
16
 
  if fpSymLink ('test.txt','new.txt')<>0 then
17
 
    writeln ('Error when symlinking !');
18
 
  { Removing test.txt still leaves new.txt
19
 
    Pointing now to a non-existent file ! }
20
 
  If fpUnlink ('test.txt')<>0 then
21
 
    Writeln ('Error when unlinking !');
22
 
  Assign (f,'new.txt');
23
 
  { This should fail, since the symbolic link
24
 
    points to a non-existent file! }
25
 
  {$i-}
26
 
  Reset (F);
27
 
  {$i+}
28
 
  If IOResult=0 then
29
 
    Writeln ('This shouldn''t happen');
30
 
 { Now remove new.txt also }
31
 
 If fpUnlink ('new.txt')<>0 then
32
 
   Writeln ('Error when unlinking !');
33
 
end.