WriteFile要求一个PChar类型的参数,如下调用
WriteFile(CommHandle, pBuffer, dwBlockSize, dwTotalBytesSent, nil)
定义一个数组:szTxBuf :array[0.. RX_BUFFER_SIZE] of Byte;
如何传递该数组到pBuffer。
WriteFile(CommHandle, pBuffer, dwBlockSize, dwTotalBytesSent, nil)
定义一个数组:szTxBuf :array[0.. RX_BUFFER_SIZE] of Byte;
如何传递该数组到pBuffer。
结果写入的是szTxBuf 的地址, 而非数据值即, 如何得到一个数组其数据区域的指针
function WriteFile(hFile: THandle; const Buffer; nNumberOfBytesToWrite: DWORD;
var lpNumberOfBytesWritten: DWORD; lpOverlapped: POverlapped): BOOL; stdcall;
WriteFile(CommHandle, pBuffer[0], dwBlockSize, dwTotalBytesSent, nil);
应该是不用指针去传缓冲区
WriteFile(CommHandle, szTxBuf[0], dwBlockSize, dwTotalBytesSent, nil);