[oclug] [OT] C: get local ip?

Matt Rose mattrose at folkwolf.net
Tue Mar 19 15:27:37 EST 2002


I don't think that'll do what you think it'll do.  just from looking at
the man page, all it does is read the line in /etc/networks, which, under
linux just contain the network address of the subnet you're in.
Unfourtunately, I don't know of any way to do what the original poster was
asking, other than using IN_ADDR_ANY, but I know getnetent won't do it.

--------------------------------------------------------------------------
Matt Rose     mattrose at folkwolf.net    Visit my blog!  http://folkwolf.net
He's an immortal amnesiac grifter on the edge. She's a warm-hearted
antique-collecting schoolgirl prone to fits of savage, blood-crazed
rage. They fight crime!
Random Crime Fighters by http://www.rain-street.org/fightcrime.htm

On Tue, 19 Mar 2002, Robert Charbonneau wrote:

> man 3 getnetent
>
> Then browse from there.
>
> On March 19, 2002 12:18 pm, you wrote:
> > How can I get the default interface IP in C?  I want a string of the
> > form "192.168.1.1" for the default interface of the local host.
> >
> > thanks,
> > james
> >
> >
> >
> > _______________________________________________
> > oclug mailing list
> > oclug at lists.oclug.on.ca
> > http://www.oclug.on.ca/mailman/listinfo/oclug
>
> --
> ----------
> "If you could twist and turn away,
>  If you could tear yourself in two again,
>  If I could, you know I would,
>  If I could I would, let it go..."
> 	- U2, _Bad_
>
> Robert Charbonneau
> etriaph at kdesktop.org
> ----------
> _______________________________________________
> oclug mailing list
> oclug at lists.oclug.on.ca
> http://www.oclug.on.ca/mailman/listinfo/oclug
>




More information about the OCLUG mailing list