[fpc-pascal]getting my local ip
Michael Van Canneyt
michael.vancanneyt at wisa.be
Fri Mar 15 16:12:19 CET 2002
On Fri, 15 Mar 2002, ron wilson wrote:
> ok - thats what i thought - so they both point to the same memory area. my
> question is this then: how do i access the list. i guess my pascal syntax
> is too far gone. i understand pointers pretty well, but in this case, i'm
> lost. what we have here is a pointer to pchar - ^pchar. so to access the
> first pchar in the list i would code this:
> program test;
> pc: pchar;
> h: hostent;
> /* fill h here */
No, no. You can use the fact that a pointer can be considered as a
pointer to an array.
While h.h_addr_list[i]<>Nil do
PC:=h_addr_list[i]; // Get pchar pointer
S:=StrPas(pc); // Convert to pascal string.
// Do something with S.
Have a look at the inet unit, the GetAlias method. It does exactly the
same for Linux.
More information about the fpc-pascal