Le 16/01/2017 à 20:20, Paul Isaacs a écrit :
Are program parameters tied in any way to command line parameters?--
No, *program* parameters are a misconception of the original ISO7185 pascal standard, kept in the ISO1026 extended program standard. They are a misconception because they are "implementation dependent" in both standards, which means they fool one main goal of pascal, portability. Accessing *command line* parameters is usually made through Borland Pascal extensions ParamCount and ParamStr, which are not contained in any standard ... See, e.g. the following non conformant modification of BindingDemo.pas (contained in the gpc doc) which was originally ISO10216 conformant ------------------------------------------------------------------- program BindingDemo (Input, Output, f);
var f: bindable Text; b: BindingType;
procedure BindFile (var f: Text); var b: BindingType; begin Unbind (f); b := Binding (f); b.Name:=ParamStr(1); {... here it is ...} Bind (f, b); b := Binding (f); if not b.Bound then WriteLn ('File not bound -- try again.') end;
begin BindFile (f); { Now the file f is bound to an external file. We can use the implementation defined fields of BindingType to check if the file exists and is readable, writable or executable. } b := Binding (f); Write ('The file '); if b.Existing then WriteLn ('exists.') else WriteLn ('does not exist.'); Write ('It is '); if not b.Readable then Write ('not '); Write ('readable, '); if not b.Writable then Write ('not '); Write ('writable and '); if not b.Executable then Write ('not '); WriteLn ('executable.') end. -------------------------------------------------------- Hope this helps
Maurice Lombardi Laboratoire Interdisciplinaire de Physique (LIPhy) Universite Grenoble Alpes & CNRS - Pôle Phitem Bat E - 140 rue de la physique 38400 Saint Martin d'Heres FRANCE
Fax: 33 (0)4 76 63 54 95 mailto:Maurice.Lombardi@univ-grenoble-alpes.fr