现有
shuzu: array of byte;
temp:string
shuzu[0]:=...;
shuzu[1]:=...;
shuzu[2]:=...;
shuzu[3]:=...;如何把shuzu转化为型string;
因为有
WriteFile(hComm,PChar(temp)^,Length(shuzu),lrc,nil);
而我想用
WriteFile(hComm,PChar(shuzu)^,Length(shuzu),lrc,nil);
这是 windows API 函数writeFile的定义;
BOOL WriteFile(
HANDLE hFile,
LPCVOID LpBuffer,
DWORD nNumerofofBytesToWrite,
LPDWORD lpNumberofBytesWritten,
LPOVERLAPPED lpoverlapped
)
shuzu: array of byte;
temp:string
shuzu[0]:=...;
shuzu[1]:=...;
shuzu[2]:=...;
shuzu[3]:=...;如何把shuzu转化为型string;
因为有
WriteFile(hComm,PChar(temp)^,Length(shuzu),lrc,nil);
而我想用
WriteFile(hComm,PChar(shuzu)^,Length(shuzu),lrc,nil);
这是 windows API 函数writeFile的定义;
BOOL WriteFile(
HANDLE hFile,
LPCVOID LpBuffer,
DWORD nNumerofofBytesToWrite,
LPDWORD lpNumberofBytesWritten,
LPOVERLAPPED lpoverlapped
)
解决方案 »
- SpeedButton的transparent属性为true ,Flat:=True 一运行程序仍然不透明,怎么办!!
- 请各位帮忙看看,小问题来的.
- 求助: DeviceIoControl的使用问题
- 高手赐教,怎样实现这样的控件拖放?
- 请问﹕关于保存图片问题﹖
- 类似c语言中的malloc和realloc函数是什么??
- 困扰很多高手的问题,但我还是感觉有高手可以解决的,进来说吧,UP的都有分。。。
- 一个简单的出勤系统需要多少钱?
- 怎么把接口中的事件引出来?InterfaceConnect完后该怎么做?
- Help、help、help me!!!
- ado怎样连接 excel文档
- 请问有联接sybase服务器(并查询网内的服务器名),并把里面数据倒出来的例子吗?
tmp : string;
shuzu: array[0..3] of byte;
i : integer;
begin
shuzu[0]:=...;
shuzu[1]:=...;
shuzu[2]:=...;
shuzu[3]:=...;
setlegnth(tmp,legnth(shuzu)); For i:=0 to length(shuzu)-1 do
tmp[i]:=inttostr(shuzu[i]); WriteFile(hComm,PChar(shuzu)^,Length(shuzu),lrc,nil);
End;行了。。
byte 可以用inttostr直接搞成strings
:)希望给全分并早点结贴。
我测试通过的。
:)
over!!!
WriteFile(hComm,shuzu,SizeOf(shuzu),lrc,nil);
var shuzu: array[0..9] of byte;
i:integer;
begin
edit1.Text:='';
shuzu[0]:=1;
shuzu[1]:=2;
shuzu[2]:=3;
for i:=0 to 2 do
edit1.Text:=edit1.Text+inttostr(shuzu[i]);
end;
tmp[i]:=inttostr(shuzu[i]); WriteFile(hComm,PChar(shuzu)^,Length(shuzu),lrc,nil);
End;//试了没成功WriteFile(hComm,shuzu,SizeOf(shuzu),lrc,nil);//ok +100
tmp[i+1]:=inttostr(shuzu[i]);