~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcdocs/unixex/ex37.pp

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Program Example37;
 
2
 
 
3
{ Program to demonstrate the Popen function. }
 
4
 
 
5
uses BaseUnix,Unix;
 
6
 
 
7
var f : text;
 
8
    i : longint;
 
9
 
 
10
begin
 
11
  writeln ('Creating a shell script to which echoes its arguments');
 
12
  writeln ('and input back to stdout');
 
13
  assign (f,'test21a');
 
14
  rewrite (f);
 
15
  writeln (f,'#!/bin/sh');
 
16
  writeln (f,'echo this is the child speaking.... ');
 
17
  writeln (f,'echo got arguments \*"$*"\*');
 
18
  writeln (f,'cat');
 
19
  writeln (f,'exit 2');
 
20
  writeln (f);
 
21
  close (f);
 
22
  fpchmod ('test21a',&755);
 
23
  popen (f,'./test21a arg1 arg2','W');
 
24
  if fpgeterrno<>0 then
 
25
     writeln ('error from POpen : errno : ', fpgeterrno);
 
26
  for i:=1 to 10 do
 
27
    writeln (f,'This is written to the pipe, and should appear on stdout.');
 
28
  Flush(f);
 
29
  Writeln ('The script exited with status : ',PClose (f));
 
30
  writeln;
 
31
  writeln ('Press <return> to remove shell script.');
 
32
  readln;
 
33
  assign (f,'test21a');
 
34
  erase (f)
 
35
end.
 
 
b'\\ No newline at end of file'