Hi!
Is there a way to set STDOUT in a PHP script dynamically (by command
line argument,...)? I have large blocks of non-PHP-code (outside <?
php... ?>) and I don't want to use "print" for all these lines.
Greetings,
Markus 7 2095
cipher wrote:
Hi!
Is there a way to set STDOUT in a PHP script dynamically (by command
line argument,...)? I have large blocks of non-PHP-code (outside <?
php... ?>) and I don't want to use "print" for all these lines.
Greetings,
Markus
I don't understand. If it's outside the <?php ... ?>, they should just
be printed anyway.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
On Tue, 11 Dec 2007 10:41:50 +0100, cipher <ma****************@gmail.com>
wrote:
Hi!
Is there a way to set STDOUT in a PHP script dynamically (by command
line argument,...)? I have large blocks of non-PHP-code (outside <?
php... ?>) and I don't want to use "print" for all these lines.
Anything outside <?php ?blocks will go to PHP's STDOUT (possible
captured in output buffers if you like). On the command line you can
simple direct the STDOUT (and/or STDERR) to whatever you like...
--
Rik Wasmus
Yes, I know that. But how can I redirect the script's output to a
file, if I call the script from command line and if I don't want to
use pipes?
On 11 Dez., 12:12, Jerry Stuckle <jstuck...@attglobal.netwrote:
cipher wrote:
Hi!
Is there a way to set STDOUT in a PHP script dynamically (by command
line argument,...)? I have large blocks of non-PHP-code (outside <?
php... ?>) and I don't want to use "print" for all these lines.
Greetings,
Markus
I don't understand. If it's outside the <?php ... ?>, they should just
be printed anyway.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
cipher wrote:
Is there a way to set STDOUT in a PHP script dynamically (by command
line argument,...)? I have large blocks of non-PHP-code (outside <?
php... ?>) and I don't want to use "print" for all these lines.
Not sure what you're asking. STDOUT can be redirected in most shells to a
file using a construction like this:
php myscript.php >somefile.html
Or piped into STDIN of some other program using:
php myscript.php | someprogram
This is supported in bash, csh, zsh -- any shell I can think of. Even
DOS's COMMAND.COM.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 3 days, 22:23.]
Sharing Music with Apple iTunes http://tobyinkster.co.uk/blog/2007/1...tunes-sharing/
On Tue, 11 Dec 2007 13:00:53 +0100, cipher <ma****************@gmail.com>
wrote:
On 11 Dez., 12:12, Jerry Stuckle <jstuck...@attglobal.netwrote:
>cipher wrote:
Hi!
Is there a way to set STDOUT in a PHP script dynamically (by command
line argument,...)? I have large blocks of non-PHP-code (outside <?
php... ?>) and I don't want to use "print" for all these lines.
Greetings,
Markus
I don't understand. If it's outside the <?php ... ?>, they should just be printed anyway.
Yes, I know that. But how can I redirect the script's output to a
file, if I call the script from command line and if I don't want to
use pipes?
Why do you not 'want' to use pipes? What is it you are actually trying to
do?
--
Rik Wasmus
cipher wrote:
On 11 Dez., 12:12, Jerry Stuckle <jstuck...@attglobal.netwrote:
>cipher wrote:
>>Hi! Is there a way to set STDOUT in a PHP script dynamically (by command line argument,...)? I have large blocks of non-PHP-code (outside <? php... ?>) and I don't want to use "print" for all these lines. Greetings, Markus
I don't understand. If it's outside the <?php ... ?>, they should just be printed anyway.
-- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstuck...@attglobal.net ==================
Yes, I know that. But how can I redirect the script's output to a
file, if I call the script from command line and if I don't want to
use pipes?
(Top posting fixed)
You can't. That's the purpose of pipes.
You can buffer the output and write that to a file, but that's about it.
And please don't top post. Thanks.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
cipher wrote:
Yes, I know that. But how can I redirect the script's output to a file,
if I call the script from command line and if I don't want to use pipes?
Firstly, please quote correctly. Quote only the part of the post to which
you reply, and then place your reply underneath it.
Secondly, what have you got against pipes?
Lastly, ob_start() is what you want.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 3 days, 23:06.]
Sharing Music with Apple iTunes http://tobyinkster.co.uk/blog/2007/1...tunes-sharing/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Harayasu |
last post by:
Hi,
Using fgets() I can read from stdin and with fputs() I can write to
stdout. Now I have two programs, one writing to stdin and the other
one reading from stdin. And I would like the second...
|
by: Rouben Rostamian |
last post by:
Consider the following demo program:
#include <stdio.h>
int main(void)
{
unsigned char c;
for (c=0; c<15; c++)
putchar(c);
|
by: John Forkosh |
last post by:
I have a C program that writes binary output to stdout,
which works fine in Unix/Linux. But when someone else
compiled and ran it in Windows, every time the program
emitted a 0x0A, Windows...
|
by: Paul Edwards |
last post by:
Is it permissible in C89 to do an "fclose(stdout)"
and then exit, or is the C runtime library allowed to
assume that stdout remains open and thus unconditionally
do an fclose itself?
Thanks. ...
|
by: David Mathog |
last post by:
A program of mine writes to a tape unit. Output can be either through
stdout or through a file opened with fopen(). When all the data is
transferred to tape the program needs to close the output...
|
by: Torsten Bronger |
last post by:
Hallöchen!
I start a python script with subprocess from another Python script
with
python = subprocess.Popen(,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
However, this child script...
|
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= |
last post by:
Hello,
I have a C# application in which I start another process which produces
output to stdout and stderr. In fact, that process is the uSoft VS2005 C/C++
compiler itself! I would like to...
|
by: kreismaler |
last post by:
I have some problems to understand the difference of using the STDOUT and using "anonymous pipes" as shown below:
using System;
using System.Diagnostics;
using System.IO;
namespace...
|
by: lovecreatesbea... |
last post by:
For example, in Bourne Shell both stdout and stderr can be re-directed
to /dev/null,
$ ./a.out 2>&1 /dev/null
then is there any difference still?
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |