Click here to Skip to main content
12,883,884 members (36,997 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


1 bookmarked
Posted 8 Jun 2010

Converting TCHAR[] to string, while getting PC Name

, 8 Jun 2010 CPOL
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...


Members may post updates or alternatives to this current article in order to show different approaches or add new features.

17 May 2010
1 alternative  
Hi there,Its been a while since I wrote my last article. Since got myself into a problem of getting the system name of my PC.I dragged my C instincts into the MSDN world of asking how to get the PC name.After fiddling for a while I got hold of the PC name, not that difficult as a...


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


About the Author

Alain Rist
France France
No Biography provided

| | Privacy | Terms of Use | Mobile
Web02 | 2.8.170422.1 | Last Updated 9 Jun 2010
Article Copyright 2010 by Alain Rist
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid