在Delphi中调用API的问题

haoyanbin2002cn 2002-12-19 04:55:54

在调用
function WriteFile(hFile: THandle; const Buffer; nNumberOfBytesToWrite: DWORD;
var lpNumberOfBytesWritten: DWORD; lpOverlapped: POverlapped): BOOL; stdcall;
有个问题

var
str:string;
begin
WriteFile(hFile,pchar(str)^nBytes,lcb,nil);
//为什么此处是pchar(str)^而不是pchar(str)
end;
...全文
38 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
wengj 2002-12-19
  • 打赏
  • 举报
回复
buffer 是一个Char数组,而不是一个PChar地址

1,184

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧