0

I'm trying to retrieve the name of the computer that my programm is running on. This is the code:

TCHAR compName[MAX_COMPUTERNAME_LENGTH + 1]; 
  DWORD cnt = MAX_COMPUTERNAME_LENGTH + 1;
  std::string name = "";
 if( GetComputerName( compName, &cnt) )
  {
    name = compName;
  }
 return name;

The compiler comes up with this error:
Error C2660: 'GetComputerNameA' : function does not take 2 arguments.

Does anyone has an idea ??

Grtz,

2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by disc
0

You must have another function in your program called GetComputerName(). Your code snippet compiled without error in a simple test program that only contains a main() function.

0

Stupid, stupid, stupid :confused: :confused: :sad: :sad:

Thanks Ancient Dragon...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.