Skip to content

Commit

Permalink
cin test
Browse files Browse the repository at this point in the history
  • Loading branch information
maloel committed Jan 2, 2025
1 parent a6f90a6 commit a5d8ea4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tools/dds/dds-adapter/rs-dds-adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,21 @@ try
device_handlers_list.erase( dev );
} );

std::cin.ignore(std::numeric_limits<std::streamsize>::max(), 0);// Pend until CTRL + C is pressed
std::cin.clear(); // unset good/bad/fail/eof bits
std::cin.ignore( std::numeric_limits< std::streamsize >::max(), 0 ); // Pend until CTRL + C is pressed
if( std::cin.bad() )
std::cout << "CIN is BAD" << std::endl;
if( std::cin.good() )
std::cout << "CIN is GOOD" << std::endl;
if( std::cin.fail() )
std::cout << "CIN is FAIL" << std::endl;
if( std::cin.eof() )
std::cout << "CIN is EOF" << std::endl;
if( ! std::cin.good() )
{
std::cout << "CIN is bad!" << std::endl;
std::this_thread::sleep_for( std::chrono::seconds( 120 ) );
}

std::cout << "Shutting down rs-dds-adapter..." << std::endl;

Expand Down

0 comments on commit a5d8ea4

Please sign in to comment.