[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: Sv: [CPROG] Eksekvere kommando og læse output



On 8 Mar 2000, Kristian Bjørnskov wrote:

> On Tue, 7 Mar 2000 22:37:10 +0100, Danni Finne <sslug@sslug> wrote:
> > Tak for dit svar... Jeg går ud fra at denne metode er hurtigere end Thomas
> > Rasmussens eksempel ? Ellers kan jeg ikke rigtig se nogle fordele i at gøre
> > det på denne måde i forhold til det andre eksempel....
> 
> Der er nu også andre fordele. Først og fremmest skal du ikke finde et filnavn
> og sikre dig mod at der er andre der har oprettet filen først og at der ikke er
> et symbolsk link med det navn du vælger etc. Faktisk svarer den pipe jeg har
> lavet til at du eksekverer: ls | ./myProgram og lader myProgram læse fra
> STDIN. myProgram kan derudover begynde at læse og lave hvad der nu skal laves
> før ls er færdig. med system("ls > file"), skal du vente på at ls bliver færdig
> før du kan læse filen.

Og, lad mig tilføje at du også har mulighed for at både læse og skrive
fra/til kommandoen. Meget sejt. F.eks. popen uden fork giver dig kun
mulighed for det ene.

Mads

+----------------------------------------------------------------------+
|  Mads Bondo Dydensborg.                                              |
|  Distlab eksperimental network administrator.                        |
|  Phone: +45 35 32 14 18,                      email: sslug@sslug |
+----------------------------------------------------------------------+ 



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *