Errors in compile.....
MN_EXPORT cnErrCode MN_DECL infcGetHubPorts(std::vectorstd::string &comHubPorts)
{
comHubPorts.clear();
FILE pfd = popen( "ls /dev/ttyXRUSB", "r" );
if ( pfd <= 0 )
{
throw std::runtime_error( "Command or process could not be executed." );
}
while ( !feof(pfd) )
{
char buf[ 1024 ] = {0};
if ( fgets(buf, sizeof(buf), pfd) > 0 )
{
std::string str(buf);
// TODO: check the VID/PID of the device using udevadm/libudev to
// verify that this is a Teknic SC4-Hub (vid=2890, pid=0213)
comHubPorts.push_back(str.substr(0, str.length()-1));
}
}
pclose( pfd );
return MN_OK;
}
ERRORS FIXED BY:
MN_EXPORT cnErrCode MN_DECL infcGetHubPorts(std::vectorstd::string &comHubPorts)
{
comHubPorts.clear();
FILE pfd = popen( "ls /dev/ttyXRUSB", "r" );
if ( !pfd )
{
throw std::runtime_error( "Command or process could not be executed." );
}
while ( !feof(pfd) )
{
char buf[ 1024 ] = {0};
if ( fgets(buf, sizeof(buf), pfd) != NULL)
{
std::string str(buf);
// TODO: check the VID/PID of the device using udevadm/libudev to
// verify that this is a Teknic SC4-Hub (vid=2890, pid=0213)
comHubPorts.push_back(str.substr(0, str.length()-1));
}
}
pclose( pfd );
return MN_OK;
}
If you use this fix, I must warn that I have no idea if it is the CORRECT way to fix the compile error.