[Delphi] Problem z StrPas

0

Witajcie.

Mam sobei taki kod :

function TForm1.IPAddrToName(IPAddr : string): string;
var 
  SockAddrIn: TSockAddrIn; 
  HostEnt: PHostEnt; 
  WSAData: TWSAData; 
begin 
  WSAStartup($101, WSAData); 
  SockAddrIn.sin_addr.s_addr:= inet_addr(PChar(IPAddr)); 
  HostEnt:= gethostbyaddr(@SockAddrIn.sin_addr.S_addr, 4, AF_INET); 
  if HostEnt<>nil then
  begin
    result:=StrPas(Hostent^.h_name)
  end 
  else 
  begin 
    result:=''; 
  end; 
end;

i jak chce skompilować, wurzuca mi błąd w lini:

    result:=StrPas(Hostent^.h_name)

Niby że : [Error] Unit1.pas(107): Undeclared identifier: 'StrPas'.
Co z tym zrobić?? Czy to mozliwe żeby niebyło tej funkcji??

0

A dodałeś moduł SysUtils?

Poza tym wystarczy

if HostEnt <> nil then Result := Hostent^.h_name;

String i PChar są zgodne w sensie przypisania, a Result jako String jest na początku purty.

1 użytkowników online, w tym zalogowanych: 0, gości: 1