I was just wondering if it's possible to get a function in C++ on a Unix system to return -1 and not 255?
I have been programming some OpenCV stuff and realised stuff wasnt working as intended. The functions I was using were meant to return -1, but had been returning 255 the whole time. So I was just wondering if there is any configuration I'd be able to do to allow a return code of -1?
This is the example I am using from my textbook
int main( int argc, char** argv ) {
int i = 0;
cv::namedWindow( "Example3", cv::WINDOW_AUTOSIZE );
cv::VideoCapture cap;
cap.open( std::string(argv[1]) );
cv::Mat frame;
for(;;) {
cap >> frame;
if( frame.empty() ) break; // Ran out of film
cv::imshow( "Example3", frame );
std::cout<<"waitkey:"<<cv::waitKey(33) << std::endl;
}
return -1;
}
Information on waitkey() can be found here
It seems that this issue is actually a bug with the OpenCV code. The bug has been addressed and pushed to the master branch of the OpenCV github