Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

How to: Retrieve the Local Machine Name (C++/CLI)

The following code example demonstrates the retrieval of the local machine name (the name of the computer as it appears on a network). You can accomplish this by getting the MachineName string, which is defined in the Environment namespace.

// machine_name.cpp
// compile with: /clr
using namespace System;

int main() 
{
   Console::WriteLine("\nMachineName: {0}", Environment::MachineName);
   return 0;
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.