【发布时间】:2012-06-06 10:54:30
【问题描述】:
我正在 Delphi XE2 中编译我的应用程序。它是在 delphi 7. 中开发的。我的代码如下:
type
Name = array[0..100] of PChar;
PName = ^Name;
var
HEnt: pHostEnt;
HName: PName;
WSAData: TWSAData;
i: Integer;
begin
Result := False;
if WSAStartup($0101, WSAData) <> 0 then begin
WSAErr := 'Winsock is not responding."';
Exit;
end;
IPaddr := '';
New(HName);
if GetHostName(HName^, SizeOf(Name)) = 0 then <-----ERROR
begin
HostName := StrPas(HName^);
HEnt := GetHostByName(HName^);
"
"
so on...
end;
当我尝试编译代码时,我收到以下错误:
当我在另一个应用程序中尝试此代码时,它在 Delphi 7 中运行良好。 如何从字符指针转换为 PAnsiChar 类型以使其在 Delphi XE2 上运行??。
【问题讨论】:
-
错误出现在哪一行?
-
我刚才标记为ERROR...
标签: delphi delphi-xe2