Answers for "c++ dev/null"

C++
0

c++ dev/null

#include <iostream>

void foo()
{
    std::cout << "Boring message. " << std::endl;
}

int main()
{
    std::cout.setstate(std::ios::failbit) ;
    foo();
    std::cout.clear() ;
    std::cout << "Interesting message." << std::endl;
    return 0;
}
Posted by: Guest on November-23-2020

Browse Popular Code Answers by Language