Click to See Complete Forum and Search --> : How to get Domain Name ?


M.Anand
May 17th, 1999, 12:38 AM
How do I retrieve the Name of a domain on which my machine is running ( like .microsoft.com) ?


M.Anand
Development - Lead ,
Satyam Infoway Limited,
Chennai - 600034
India

mpolachary
May 17th, 1999, 06:42 AM
Is it right?


char lpBuffer[50];
GetEnvironmentVariable("userdomain",lpBuffer,50);
printf(lpBuffer);

M.Anand
May 17th, 1999, 07:50 AM
Hi

Thanks for your response but I think "userdomain" is a crucial parameter. I know my Machine Name and nothing else. I got the solution anyway. I used gethostbyName which returns HOSTENT structure which has the Domain details

Anand

M.Anand
Development - Lead ,
Satyam Infoway Limited,
Chennai - 600034
India