[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: c++ query
Hello,
There are different ways to do this.
One way is to close the file Discriptor 1, and then issue a open system
call with the filename as the one where the output has to be sent, the open
system call will us the smallest fd avilable, [i.e. 1]. There by any printf
command will send the output to the file which has been opened.
-Thanks,
Syed Khaleelulla.
--------------------
On Sat, 30 Sep 2000, Harpreet Singh (RBIN/DCA-NMP) wrote:
+Hi,
+
+Is there a way to close the standard output and reassign cout to point to a
+file.
+( What I want to do is give an option to the user, if a file name has been
+specified output should be written to the file else to the standard output;
+and the user will be using cout )
+
+Thanks in advance
+
+
+
+
+
+---------------------------------------------
+LIP is all for free speech. But it was created
+for a purpose. Violations of the rules of
+this list will result in stern action.
+
***************************************************************************
_.-.
.-. `) | .-.
_.'`. .~./ \.~. .`'._
.-'`.'-'.'.-: ;-.'.'-'.`'-.
`'`'`'`'` \ / `'`'`'`'`
/||\
/ ^^ \ In the world without fence... which need gates?
************ `'``'`********************************************************
Syed Khaleelulla, 26, Hosur Main Road, Bommanhalli,
Senior Software Engineer, Bangalore - 560068, India.
Wipro Global R&D. Tel: 91-80-5722293/6 Extn- 2203.
***************************************************************************
- References:
- c++ query
- From: Harpreet Singh (RBIN/DCA-NMP)