我在使用这个控件时发现,当发送的字符少于8个字节时,它能一次接收,当超过
8个字节时,他会分成几次接收[事件RxChar()],每次8个字节。
我现在想问的问题是:怎样才能一次收完所有的数据,不要这样一次8个字节的
接收。第2个问题:有什么加密算法可以加密/解密Char(0)这种空字符?我的数据中包含
有空字符。第3个问题:delphi编写dll怎样才能传送包含有空字符的串给pb程序,和pb怎样传
这样的数据给dll
8个字节时,他会分成几次接收[事件RxChar()],每次8个字节。
我现在想问的问题是:怎样才能一次收完所有的数据,不要这样一次8个字节的
接收。第2个问题:有什么加密算法可以加密/解密Char(0)这种空字符?我的数据中包含
有空字符。第3个问题:delphi编写dll怎样才能传送包含有空字符的串给pb程序,和pb怎样传
这样的数据给dll
>> 这样的数据给dll
用 byte 數組, 不要用字符串
这样写会报错
function Integer getdata(ref char buf[100])
或者
function Integer getdata(ref char buf[])
function Integer getdata(char buf[100])
function Integer getdata(char buf[])
都会报错,不知道该怎么做?
var
sRxStr, {卡机接收的字符串}procedure TfrmMain.ComPortRxChar(Sender: TObject; Count: Integer);
var
sTempStr: string;
iRxStrLen: integer;
begin
iRxStrLen := 12; //每次发送的字符长度
Application.ProcessMessages;
ComPort.ReadStr(sTempStr, Count);
sRxStr := sRxStr + sTempStr;
//卡机的长度符合才抓进来
if (Length(sRxStr)) = (iRxStrLen) then
begin
end
else
//每次撷取的长度会不一样,所以要判断 sRxStr (全域变量)的长度一但超过总长度,就要将sRxStr清空
//否则将永远不会进入到 if (Length(sRxStr)) = (iRxStrLen) then 这个判断式内
if (Length(sRxStr)) > (iRxStrLen) then
sRxStr := '';
end;