public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: naveen yadav <yad.naveen@gmail.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Modification required in cout function
Date: Fri, 06 Jan 2012 12:41:00 -0000	[thread overview]
Message-ID: <CAJ8eaTzx4VWQdK5wgRaD6NJfPTr=roodtDVhBdknCh-4OrP_ug@mail.gmail.com> (raw)
In-Reply-To: <CAH6eHdSzpduCogSbnXDWEX5D_xevZ=z+Ptus8G7aA1Vj+R_YHw@mail.gmail.com>

Thanks for your suggestion.

I am trying to comment the following line
        new (&buf_cout) stdio_filebuf<char>(stdout, ios_base::out);
        new (&buf_cin) stdio_filebuf<char>(stdin, ios_base::in);
        new (&buf_cerr) stdio_filebuf<char>(stderr, ios_base::out);
//        cout.rdbuf(&buf_cout);
        cin.rdbuf(&buf_cin);
        cerr.rdbuf(&buf_cerr);
        clog.rdbuf(&buf_cerr);

#ifdef _GLIBCXX_USE_WCHAR_T
        new (&buf_wcout) stdio_filebuf<wchar_t>(stdout, ios_base::out);
        new (&buf_wcin) stdio_filebuf<wchar_t>(stdin, ios_base::in);
        new (&buf_wcerr) stdio_filebuf<wchar_t>(stderr, ios_base::out);
//        wcout.rdbuf(&buf_wcout);
        wcin.rdbuf(&buf_wcin);


I am trying to comment at two places above. and building my gcc.


Thanks


On Fri, Jan 6, 2012 at 3:16 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 6 January 2012 09:45, Jonathan Wakely wrote:
>> On 6 January 2012 09:28, naveen yadav wrote:
>>> Dear All,
>>>
>>> I want to modify cout source code in GCC such that it will not print
>>> any thing on the screen.
>>>
>>> The reason is I have very large already compile code(distrubited in
>>> lib form) and it is not possible to recompile. so i left with no
>>> option but to modify in GCC code. Will you pls let me know where I can do it .
>>
>>
>> Can't you just redirect the program's output to /dev/null when you run
>> the program?
>>
>> Or close the file descriptor in your program's main() function?
>>
>> Or duplicate the file descriptor in main() to redirect the output to a file?
>
> Or replace std::cout's streambuf with a different streambuf that
> doesn't write to stdout.
>
> I could probably think of more ways to do it without altering the
> standard library.

  reply	other threads:[~2012-01-06 11:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-06  9:28 naveen yadav
2012-01-06  9:46 ` naveen yadav
2012-01-06  9:46 ` Jonathan Wakely
2012-01-06  9:48   ` Jonathan Wakely
2012-01-06 12:41     ` naveen yadav [this message]
2012-01-06 12:41       ` Jonathan Wakely
2012-01-06 12:55       ` naveen yadav
2012-01-06 14:51         ` Jonathan Wakely
2012-01-07 12:02           ` naveen yadav
2012-01-07 17:32             ` Jonathan Wakely
2012-01-09 12:29               ` naveen yadav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ8eaTzx4VWQdK5wgRaD6NJfPTr=roodtDVhBdknCh-4OrP_ug@mail.gmail.com' \
    --to=yad.naveen@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).