[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: [CPROG] Eksekvere kommando og læse output



On 7 Mar 2000, Kristian Bjørnskov wrote:

> Dette er ET EKSEMPEL. Hvis du skal bruge det i det virkelige liv, skal du have
> noget fejlhåndtering på. Specielt skal du nok checke output fra pipe og fork.
> Hvis du benytter andet end ls, som fx. netværksforbindelser bør du læse med en
> timeout. Dette gøres med select. Hvis du bruger en 2.2 kærne kan du bruge poll
> i stedet - den er mere effektiv og mindre belastende for systemet. 

Hvad med at bruge et standart library funktion "popen" med en tilsvarende
"pclose".
De fungerer på samme måde som almindelige filhåndteringsfunktioner, men
bruger et program som kilde til dataen. Check "man popen" for mere info.
Det er _meget_ nemmere end at lave det hele ved fork,dup-håndkraft.

Hilsen Valery.

-- 
=================+======================================+================
 Valery Kotchiev | Computer Science / Chemistry student | sslug@sslug
-----------------+--------------+-----------------------+----------------
http://rudiment.ehp.dk/~incore/ | finger://sslug@sslug for PGP
=========================================================================

To the systems programmer, users and applications serve only to provide a
test load.



 
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] *