delphi - What is this code doing with pointers? -
I still do not understand how the indicators work in Delphi while reviewing a library, in one function I Generally, I used the What's going on here with the pointer? What is this saying: / P> GetIPAddress (used to get the IP address of the local machine), I used the pointers (the marked line below) near a strange artist. I did not write it, but found it sometime ...
uses Winsock; Function GetIPAddress: String; Type pu_long = ^ u_long; Var varTWSAData: TWSAData; VarPHostEnt: Fistent; VarTInAddr: TInAddr; Namebook: Array [0 .. 255] Anikar; If WSAStartup ($ 101, varTWSAData) & lt; & Gt; 0 Then the result: = '' and get started hostname (Nambuf, Sagef (nominator)); VarPHostEnt: = gethostbyname (namebuf); VarTInAddr.S_addr: = u_long (pu long (varPHostEnt ^. H_addr_list ^) ^); // & lt; --- ??? Result: = WideString (inet_ntoa (varTInAddr)); End; Excluding the result: = ''; End; Finally WSACleanup; End; End;
fastend is an indicator for one, in a type defined Windows API . H_addr_list is an array of parasitic values which is actually an array of bytes (C, one four and one byte is the same thing, which is complicated in handling C API byte buffers).
Comments
Post a Comment