From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7212 invoked by alias); 9 Jan 2012 11:17:48 -0000 Received: (qmail 7202 invoked by uid 22791); 9 Jan 2012 11:17:47 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-bk0-f47.google.com (HELO mail-bk0-f47.google.com) (209.85.214.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 09 Jan 2012 11:17:13 +0000 Received: by bkbzt4 with SMTP id zt4so1517053bkb.20 for ; Mon, 09 Jan 2012 03:17:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.204.32.146 with SMTP id c18mr6997845bkd.132.1326107831882; Mon, 09 Jan 2012 03:17:11 -0800 (PST) Received: by 10.204.174.133 with HTTP; Mon, 9 Jan 2012 03:17:11 -0800 (PST) In-Reply-To: References: Date: Mon, 09 Jan 2012 12:29:00 -0000 Message-ID: Subject: Re: Modification required in cout function From: naveen yadav To: Jonathan Wakely Cc: gcc-help Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2012-01/txt/msg00054.txt.bz2 Thanks a lot Jonathan, it works for me .. On Sat, Jan 7, 2012 at 5:32 PM, Jonathan Wakely wro= te: > On 7 January 2012 06:49, naveen yadav wrote: >> Thanks a lot Jonathan, >> >> The reason for modifying stdlib is needed because i do not have source >> code of binary which i want to test. >> will you pls let me know execty lines in ios_init.cc =A0which I need to >> modify , this will help me a lot. > > Put > std::cout.setstate(ios_base::failbit); > > after cout has been constructed, so around line 102 > > >> Thanks >> >> On Fri, Jan 6, 2012 at 6:25 PM, Jonathan Wakely = wrote: >>> On 6 January 2012 12:41, naveen yadav wrote: >>>> The reason is that is we want to check effect of cout on application b= ooting. >>>> Below is simple hello world program, It still call write() system >>>> call. This may delay if >>>> we have lots of cout in applications. >>>> so we want that cout simply return without call of write(). >>> >>> std::cout.setstate(ios_base::failbit); >>> >>> If you do that at the top of main() it will prevent any writes to >>> cout. =A0If your library writes to cout before main() starts, you could >>> put that in a global object's constructor (and use >>> __attribute__((init_priority(101))) to make it run before other global >>> constructors) >>> >>> Or if you really insist on modifying the stdlib, do that in >>> ios_init.cc in ios_base::Init::Init() (not in sync_with_stdio, that's >>> the wrong place)