i needed a way to close an open serial port.
i only have pcs to work on at the moment, so i only implemented it for winXP.
it should be simple to add a mac os version.
here’s my code:
bool ofSerialClose ()
{
if (!bInited){
printf("error: serial not inited\n");
return 0;
}
bInited = false;
//---------------------------------------------
#ifdef TARGET_OSX
//---------------------------------------------
// add mac os x code here...
//---------------------------------------------
#endif
//---------------------------------------------
//---------------------------------------------
#ifdef TARGET_WIN32
//---------------------------------------------
return CloseHandle(hComm);
//---------------------------------------------
#endif
//---------------------------------------------
}