Getting the domain name



Can anyone recommend a portable way of getting the domain name of the
local machine? I find it amazing that there's no builtin method for
doing this (gethostname does not necessarily contain the domain).

Mike

.