← Back to team overview

sslug-teknik team mailing list archive

Re: oktale IP-adresser ?

 

Frank Damgaard wrote:
> 
> I dk.edb.unix var der en med et problem med at IP-adressen var
> angovet med foranstillede nuller, dvs. 212.242.040.003,
> "040" og "003" opfattes faktisk som hhv. 32 og 3 decimalt,
> hvilket giver IP adressen 212.242.32.3 som er en anden !


Formodentligt fordi indscanningen af ip-adr sker v.hj.a. sscanf (og
lign.):

	sscanf(inputbuffer, "%i.%i.%i.%i", ...)

Fra 'man sscanf':

      i      Matches an  optionally  signed  integer;  the  next
             pointer  must  be a pointer to int.  The integer is
             read in base 16 if it begins with `0x' or `0X',  in
             base 8 if it begins with `0', and in base 10 other­
             wise.  Only characters that correspond to the  base
             are used.



-- 
Automobile, n.:

    A four-wheeled vehicle that runs
up hills and down pedestrains.


Follow ups

References