[fpc-devel] Running programs with outputredirection
Ludo Brands
ludo.brands at free.fr
Sun Jul 17 12:50:17 CEST 2011
> > Cross platform solution:
> >
> > Uses process
> >
> > ...
> > p:=TProcess.Create(nil);
> > {$IFDEF WIN32}
> > p.CommandLine := 'cmd /c diff -r dir1 dir2 > diff.txt'; {$ENDIF}
> > {$IFDEF LINUX}
> > p.CommandLine := 'bash -c "diff -r dir1 dir2 > diff.txt"';
> > {$ENDIF}
> > p.Execute;
>
> Looks like this could be added to the wiki, as another solution.
> Unfortunately it won't work on other platforms (Mac...).
>
Should have been {$IFDEF UNIX} since it works also on Darwin, Solaris, etc.
Ludo
More information about the fpc-devel
mailing list