不明白你要转甚麽你要用null terminated 的字串? 可叁看Delphi的例子:Consider that you have a local string variable that you need to
initialize by calling a function that takes a PChar. One
approach is to create a local array of char and pass it to the
function, then assign that variable to the string:// VCL version// assume MAX_SIZE is a predefined constant
var
i: Integer;
buf: array[0..MAX_SIZE] of char;
S: string;
begin
i := GetModuleFilename(0, buf, SizeOf(buf)); // treats @buf as a PChar
S := buf;
//statements
end;
initialize by calling a function that takes a PChar. One
approach is to create a local array of char and pass it to the
function, then assign that variable to the string:// VCL version// assume MAX_SIZE is a predefined constant
var
i: Integer;
buf: array[0..MAX_SIZE] of char;
S: string;
begin
i := GetModuleFilename(0, buf, SizeOf(buf)); // treats @buf as a PChar
S := buf;
//statements
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货