我是 C++ 新手,我试图从 C++ 中的函数读取 COM 端口 下面是代码说明,谁能帮我完成这个?该功能应获取评论的值,请帮助我,谢谢
int ComPortReading( short, wchar_t * Data[], wchar_t **Output, SIZE_T *OutputSize )
{
int result = 1;
if( Data[0] )
{
*OutputSize = 50;
*Output = (wchar_t *) CoTaskMemAlloc(*OutputSize);
if( *Output )
{
wchar_t *EndPtr;
double v11 = wcstod(Data[0], &EndPtr); // Port Name
double v12 = wcstod(Data[1], &EndPtr); // Baud Rate
double v13 = wcstod(Data[2], &EndPtr); // Data Bits
double v14 = wcstod(Data[3], &EndPtr); // Stop Bits
double v15 = wcstod(Data[4], &EndPtr); // Parity
// Need to write code here to read COM port
// Com port settings can be taken from the above v11 - v15 values
swprintf(*Output, L"%.10lf", v11);
result = 0;
}
}
return result;
}