[fpc-pascal] including libraies ?

Paul Nicholls paulfnicholls at gmail.com
Sun Mar 14 23:15:08 CET 2010


----- Original Message ----- 
From: "Terry A. Haimann" <terry at HaimannOnline.com>
To: <fpc-pascal at lists.freepascal.org>
Sent: Monday, March 15, 2010 9:11 AM
Subject: [fpc-pascal] including libraies ?


>I tried to write a little utility to submit a command to the At Facility.
>
> The code to do this is as follows:
>
> program TestPrg;
>
> Uses Classes, Process;
>
> Var
>    i:    Integer;
>    Cmd, Pre, Post, StrVar, SwStr:    String;
>    MyProcess: TProcess;
>    SOut, EOut, StdStrLst: TStringList;
>
> Begin
>    StdStrLst   := TStringlist.Create;
>    SOut   := TStringlist.Create;
>    EOut   := TStringlist.Create;  EOut := TStringlist.Create; MyProcess := 
> TProcess.Create(nil);  MyProcess.CommandLine := 'at now'; 
> MyProcess.Options := MyProcess.Options + [poUsePipes];  MyProcess.Execute; 
> StdStrLst.Clear;
>      StdStrLst.Add('awk -F":" ''{print $1"\t"$3"\t"$4}'' /etc/passwd | 
> sort');    StdStrLst.SaveToStream(MyProcess.Input);    StdStrLst.Clear; 
> StdStrLst.Add(chr(4));
>      StdStrLst.SaveToStream(MyProcess.Input);
>      SOut.LoadFromStream(MyProcess.Output);
>      For i:=1 to SOut.Count Do
>          WriteLn(SOut.Strings[i]);
>      EOut.LoadFromStream(MyProcess.StdErr);
>      For i:=1 to EOut.Count Do
>          WriteLn(EOut.Strings[i]);
> End.
>
>
> Running this code from a Lazarus test program works with out any problems. 
> When running it from a Free Pascal (non gui,) the program finishes 
> normally, but nothing gets submitted to the AT Facility.
> uses Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, 
> Dialogs,
> StdCtrls, Process;
>
> Someone on the Lazarus List recommend I add SysUtils to my utility 
> program.  I am not sure how to do this.  SysUtils has many included files 
> in there and they are all in other directories, none of which are in my 
> path.  I am sure there is some simple method here that I am totally 
> ignorant of.
>

HI Terry, you should be able to just include SysUtils in your uses clause 
without any issues.

The compiler should be able to find that unit (and others needed) 
automatically...

{code}
Uses Classes, Process,SysUtils;
{code}

cheers,
Paul 




More information about the fpc-pascal mailing list