[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] Midlertidig udskrift til stderr



On Sun, Apr 13, 2003 at 05:42:52PM +0200, Klaus S. Madsen wrote:
> Start af redirection:
> 
> int oldstderr = dup(2);
> int newstderr = open("fil.log", O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
Okey... Her mangler der et O_WRONLY flag til open parametrene

> dup2(2, newstderr);
Og her er der byttet om på parametrerækkefølgen

> close(newstderr);
> 
> Efter den dup2, vil fildescriptor 2 (som er stderr) pege på din fil.
> 
> Stop af redirection:
> 
> dup2(2, oldstderr)
Og igen er der byttet om på parameterrækkefølgen.

Ellers skulle det vist virke ;-)

-- 
/-----------------------------------------------------\
| Klaus S. Madsen      | "Failure is not an option... |
| ICQ: 45400164        |  It comes bundled with your  |
| www.hjernemadsen.org |  Microsoft products!"        |
\-----------------------------------------------------/


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 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] *