summaryrefslogtreecommitdiff
path: root/fpcdocs/olinuxex/ex23.pp
blob: e82c2fff849b63d69108277c66bb92fb9aa569f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Program Example23;

{ Program to demonstrate the Chmod function. }

Uses oldlinux;

Var F : Text;

begin
  { Create a file }
  Assign (f,'testex21');
  Rewrite (F);
  Writeln (f,'#!/bin/sh');
  Writeln (f,'echo Some text for this file');
  Close (F);
  { Octal() makes the correct number from a
    number that LOOKS octal }
  Chmod ('testex21',octal (777));
  { File is now executable  }
  execl ('./testex21');
end.