?
Solved

c doubt-- How to get the fully qualified computer name

Posted on 2005-03-18
4
Medium Priority
?
235 Views
Last Modified: 2012-06-27
Hello experts,
                   I am currently using the below code to get the computer name

if (WSAStartup(0x0101, &wsaData))
{
      WriteToLog("start failed");
}      

      gethostname( szHostname, sizeof( szHostname ));


But when I run I get the system name only (as systemA).

What I want is the fully qualified system name as systemA.server.com

Any ideas???

I aslo used getcomputername()  function, but same result

Early help appreciated

Jango

0
Comment
Question by:jango_ms
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 8

Expert Comment

by:novitiate
ID: 13581695
use
gethostbyaddr

_novi_
0
 
LVL 8

Accepted Solution

by:
novitiate earned 500 total points
ID: 13581707
0
 
LVL 58

Expert Comment

by:Julian Hansen
ID: 13581917
What about GetComputerNameEx ?
0
 

Author Comment

by:jango_ms
ID: 13588438
Hello all,
              I used gethostname(0 function and succeeded. Anyway thanks for the suggestions novitiate an julianH. I am giving points to novitiate .


Regards

jango
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question