[ale] C question

Fulton Green me at FultonGreen.com
Tue Sep 19 17:55:54 EDT 2000


"man inet_addr" tells all. Well, not quite all. Time to break out "Beginning
Linux Programming" from Wrox, or similar material. I honed my network
programming chops with it.

On Tue, Sep 19, 2000 at 04:44:14PM -0500, Gary Maltzen wrote:
> An IPv4 address (or mask) is a 32-bit number; for convenience it is
> represented as four bytes using dotted decimal notation.
> 
>  10.20.30.40 means (C-expression-wise)
> 
>   (10 << 24) | (20 << 16) | (30 << 8) | 40
> 
> See 'man ntohs' for byte-order conversions.
> 
> The "system" function requires a command string, i.e.
> 
>   "/sbin/ifconfig eth0 10.20.30.40"
> 
> This means you will have to convert each of the four component bytes to a
> decimal equivalent for inclusion in the string you pass to the "system"
> function.
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.





More information about the Ale mailing list