bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] in-place edit request


From: Eli Zaretskii
Subject: Re: [bug-gawk] in-place edit request
Date: Wed, 26 Dec 2012 05:40:19 +0200

> From: Aharon Robbins <address@hidden>
> Date: Tue, 25 Dec 2012 22:51:05 +0200
> Cc: address@hidden, address@hidden,
>  address@hidden, address@hidden
> 
> > >   char buf[100];  /* say */
> > >   sprintf(buf, "/dev/fd/%d", save_fd);
> > > 
> > >   fp = freopen(buf, "w", stdout);
> > >   close(save_fd);
> > >   save_fd = -1;
> > > 
> > > Ta da!
> > > 
> > > Details left as an exercise for the reader.
> >
> > But /dev/fd/N is not portable :-(
> 
> Solaris, Linux, *BSD, Mac OS X, Cygwin.  Portable enough for me

But obviously not for me.

> I suspect that some combination of dup, fileno, freopen, fdopen, and
> *stdout = *fp / *fp = *stdout could be made to work on systems not
> supporting /dev/fd.

Maybe.  Me, I don't eben understand what you are trying to accomplish,
as you'd be mv'ing the output anyway.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]