Re: Modification required in cout function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6 January 2012 12:41, naveen yadav wrote:
> The reason is that is we want to check effect of cout on application booting.
> 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.  If 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)


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux