stdin PerlIO_stdin()
stdout PerlIO_stdout()
stderr PerlIO_stderr()
The easiest would be to call a perl function with a filename as an argument,
and have it setup a filehandle (global symbol).
tye says: it's easier to do it in perl ;)
update: ask on the p5p mailing list (http://lists.perl.org).
MJD says you
can't just make shit up and expect the computer to know what you mean, retardo!
I run a Win32 PPM
repository for perl 5.6x+5.8x. I take requests.
** The Third rule of perl club is a statement of fact: pod is sexy.
|
| [reply] [d/l] |
PerlIO_std... looks interesting. If I can retrieve it then I can muck about with it to my hearts content---actually all I want to do is display it in a 'nearly' realtime text window...Whole thing started as a challenge to drop 'perl' into a text editor and use it as a macro language<g>! Fun so far.
--hsm
"Never try to teach a pig to sing...it wastes your time and it annoys the pig."
| [reply] |
Could you close the current STDOUT and then reopen it as a pipe into your program?
Never tried this before, but that's the first solution that pops to mind.
---- I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
| [reply] |
open STDOUT, ">&4"; # i think
or
mkfifo # if your system supports it. M$, not.
You can also reopen your own stdout in the C code portion. Then attach that file handle to your tty screen buffer. | [reply] |
That would work if I could rewrite the perl buffer---but in a sense that would be cheating. I've found that the following code seems to do the trick:
stream = freopen("data.txt","w+",PerlIO_stdout());
ASSERT(stream);
setbuf(stream,mybuffer);
memset(mybuffer,0,BUFSIZ);
This gives me my own stdout buffer with which I can have my way! BTW this is not a console app, so there is no stdout, hence the use of PerlIO_stdout(). (thanks to podmaster and tye for that pointer...) So now I'll have one window for code, one for stdout, and one for stderr---or whatever! Joy!
--hsm
"Never try to teach a pig to sing...it wastes your time and it annoys the pig." | [reply] [d/l] |