首页 > 代码库 > cyg_io_read返回值是0,因为读到的字节长度在参数中
cyg_io_read返回值是0,因为读到的字节长度在参数中
len = cyg_io_read(ser_handle1, ucMasterRTURcvBuftmp, &len);//
len等于0,cyg_io_read读到的字节数在参数中的红色的len,而不是前面的len
cyg_io_read函数的说明中有:
Syntax:
Cyg_ErrNo
cyg_io_read(
cyg_io_handle_t handle,
void *buf,
cyg_uint32 *len
);
Parameters: handle—handle to the device.
buf—pointer to the buffer to store the data.
len—pointer to the size of data to receive. When the function returns, this parameter con-
tains the actual size of data received.
Description: Receive data from the device speci?ed by the handle parameter. If ENOERR is returned,
the write operation completed successfully. The actual number of bytes read is returned in
the len parameter.
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。