Click here to Skip to main content
15,881,852 members
Articles / General Programming / String

Converting TCHAR[] to string, while getting PC Name

Rate me:
Please Sign up or sign in to vote.
4.67/5 (3 votes)
8 Jun 2010CPOL 11.5K   1  
You might have considered using ::GetComputerNameA() which does the conversion for you:std::string GetSystemName(){ CHAR sBuf[MAX_COMPUTERNAME_LENGTH + 1] = {0}; DWORD dwLen = MAX_COMPUTERNAME_LENGTH; ::GetComputerNameA(sBuf, &dwLen); return std::string(sBuf);}Note...

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
France France
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions